|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.image.io.Palette
public abstract class Palette
A set of RGB colors created by a palette factory from a name. A palette can creates a color model (often indexed) or an image type specifier from the RGB colors. The color model is retained by the palette as a weak reference (not as a soft reference) because it may consume up to 256 kilobytes. The purpose of the weak reference is to share existing instances in order to reduce memory usage; the purpose is not to provide caching.
Field Summary | |
---|---|
protected java.lang.String |
name
The name of this palette. |
protected int |
numBands
The number of bands in the color model. |
protected int |
visibleBand
The band to display, in the range 0 inclusive to numBands exclusive. |
Constructor Summary | |
---|---|
protected |
Palette(PaletteFactory factory,
java.lang.String name,
int numBands,
int visibleBand)
Creates a palette with the specified name. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object object)
Compares this palette with the specified object for equality. |
java.awt.image.ColorModel |
getColorModel()
Returns the color model for this palette. |
java.awt.image.RenderedImage |
getImage(java.awt.Dimension size)
Returns the color palette as an image of the specified size. |
abstract javax.imageio.ImageTypeSpecifier |
getImageTypeSpecifier()
Returns the image type specifier for this palette. |
int |
hashCode()
Returns a hash value for this palette. |
void |
show()
Shows the palette in a windows. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.lang.String name
protected final int numBands
protected final int visibleBand
numBands
exclusive.
This is used when an image contains more than one band but only one band can
be used for computing the colors to display. For example IndexColorModel
works on only one band.
Constructor Detail |
---|
protected Palette(PaletteFactory factory, java.lang.String name, int numBands, int visibleBand)
factory
- The originating factory.name
- The palette name.numBands
- The number of bands (usually 1) to assign to numBands
.visibleBand
- The visible band (usually 0) to assign to visibleBand
.Method Detail |
---|
public java.awt.image.ColorModel getColorModel() throws java.io.IOException
java.io.FileNotFoundException
- If the RGB values need to be read from a file and this file
(typically inferred from name
) is not found.
java.io.IOException
- If an other find of I/O error occured.
javax.imageio.IIOException
- If an other kind of error prevent this method to complete.public abstract javax.imageio.ImageTypeSpecifier getImageTypeSpecifier() throws java.io.IOException
java.io.FileNotFoundException
- If the RGB values need to be read from a file and this file
(typically inferred from name
) is not found.
java.io.IOException
- If an other find of I/O error occured.
javax.imageio.IIOException
- If an other kind of error prevent this method to complete.public java.awt.image.RenderedImage getImage(java.awt.Dimension size) throws java.io.IOException
size
- The image size. The palette will be vertical if
size.height
>
size.width
java.io.IOException
- if the color values can't be read.public void show() throws java.io.IOException
java.io.IOException
- if the color values can't be read.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |