All Packages Class Hierarchy This Package Previous Next Index
Class palette.PaletteServer
java.lang.Object
|
+----palette.PaletteServer
- public class PaletteServer
- extends Object
This class exists only to initialize instances of the IndexColorModel.
The idea is that most of the "palettes" (this is the name for the
analogous object in NCSA Heirarchical Data Format files) we would want
to use are rather cumbersome to generate on the fly, especially for
an arbitrary number of values. So, we gather such code here
where a palette of arbitrary size can be retrieved easily.
Use of this class is pretty simple:
- To examine the list of available palettes, do:
String[] list = PaletteServer.getPaletteList();
- To define a "hotMetal" palette of length n:
IndexColorModel hm = PaletteServer.getPalette("hotMetal",n);
- Other types of palettes can be added to the list by modifying or
extending this class. In either case, the variable paletteList__
must be updated, a corresponding entry must be made in the
scanPaletteList method, and a method analogous to getHotMetalColors
must be established to define the new palette.
- Version:
- $Revision: 1.1.1.1 $, $Date: 1999/11/15 20:37:49 $.
- Author:
- Daren Stotler
- See Also:
- PaletteTest
-
paletteList__
-
-
getPalette(String, int)
- These are the main public methods for this class.
-
getPalette(String, int, byte[])
- These are the main public methods for this class.
-
getPalette(String, int, int)
- These are the main public methods for this class.
-
getPaletteList()
- Gives the caller a list of the palettes which can be generated.
-
scanPaletteList(String, byte[], byte[], byte[], int)
-
paletteList__
protected static final String paletteList__[]
getPaletteList
public static String[] getPaletteList()
- Gives the caller a list of the palettes which can be generated.
- Returns:
- string array of the available palette names
scanPaletteList
protected static void scanPaletteList(String pal,
byte r[],
byte g[],
byte b[],
int s)
getPalette
public static IndexColorModel getPalette(String pal,
int s)
- These are the main public methods for this class. The name of
a palette and its size is requested. An IndexColorModel is
instantiated and returned. This version has no transparency.
- Parameters:
- pal - String containing the palette name
- s - number of colors in the palette
- Returns:
- corresponding instance of IndexColorModel
getPalette
public static IndexColorModel getPalette(String pal,
int s,
int trans)
- These are the main public methods for this class. The name of
a palette and its size is requested. An IndexColorModel is
instantiated and returned. Just as in the IndexColorModel class,
offer some options with regard to transparency. Here, use just a
single pixel.
- Parameters:
- pal - String containing the palette name
- s - number of colors in the palette
- trans - the transparent pixel
- Returns:
- corresponding instance of IndexColorModel
getPalette
public static IndexColorModel getPalette(String pal,
int s,
byte a[])
- These are the main public methods for this class. The name of
a palette and its size is requested. An IndexColorModel is
instantiated and returned. Just as in the IndexColorModel class,
offer some options with regard to transparency. In this case,
the caller can select a different transparency for every pixel.
- Parameters:
- pal - String containing the palette name
- s - number of colors in the palette
- trans - the transparent pixel
- a - array of transparency (alpha) values
- Returns:
- corresponding instance of IndexColorModel
All Packages Class Hierarchy This Package Previous Next Index