| java.lang.Object org.geotools.image.io.Palette
All known Subclasses: org.geotools.image.io.IndexedPalette, org.geotools.image.io.ContinuousPalette,
Palette | abstract public class Palette (Code) | | A set of RGB colors created by a
from
a
. A palette can creates a
(often
) or an
from the RGB colors. The color model is retained by the palette
as a
(not as a
) 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.
since: 2.4 version: $Id: Palette.java 26708 2007-08-27 19:42:59Z desruisseaux $ author: Antoine Hnawia author: Martin Desruisseaux |
Field Summary | |
final PaletteFactory | factory The originating factory. | final protected String | name The name of this palette. | final protected int | numBands The number of bands in the
. | final protected int | visibleBand The band to display, in the range 0 inclusive to
Palette.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. |
Constructor Summary | |
protected | Palette(PaletteFactory factory, String name, int numBands, int visibleBand) Creates a palette with the specified name. |
Method Summary | |
final void | cache(ImageTypeSpecifier its) Puts the specified image specifier in the cache. | final void | ensureInsideBounds(int value, int min, int max) Ensures that the specified values in inside the expected bounds (inclusives). | public boolean | equals(Object object) Compares this palette with the specified object for equality. | public synchronized ColorModel | getColorModel() Returns the color model for this palette. | public RenderedImage | getImage(Dimension size) Returns the color palette as an image of the specified size.
This is useful for looking visually at a color palette.
Parameters: size - The image size. | abstract public ImageTypeSpecifier | getImageTypeSpecifier() Returns the image type specifier for this palette. | double | getOffset() Returns the offset from normalized values (values in the range [0..1])
to values in the range of this palette. | double | getScale() Returns the scale from normalized values (values in the range [0..1])
to values in the range of this palette. | public int | hashCode() Returns a hash value for this palette. | final ImageTypeSpecifier | queryCache() Returns the image type specifier from the cache, or
null . | public void | show() Shows the palette in a windows. |
name | final protected String name(Code) | | The name of this palette.
|
numBands | final protected int numBands(Code) | | The number of bands in the
.
The value is 1 in the vast majority of cases.
|
visibleBand | final protected int visibleBand(Code) | | The band to display, in the range 0 inclusive to
Palette.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.
|
Palette | protected Palette(PaletteFactory factory, String name, int numBands, int visibleBand)(Code) | | Creates a palette with the specified name.
Parameters: factory - The originating factory. Parameters: name - The palette name. Parameters: numBands - The number of bands (usually 1) to assign to Palette.numBands. Parameters: visibleBand - The visible band (usually 0) to assign to Palette.visibleBand. |
ensureInsideBounds | final void ensureInsideBounds(int value, int min, int max) throws IllegalArgumentException(Code) | | Ensures that the specified values in inside the expected bounds (inclusives).
throws: IllegalArgumentException - if the specified values are outside the bounds. |
equals | public boolean equals(Object object)(Code) | | Compares this palette with the specified object for equality.
|
getColorModel | public synchronized ColorModel getColorModel() throws IOException(Code) | | Returns the color model for this palette. This method tries to reuse existing
color model if possible, since it may consume a significant amount of memory.
throws: FileNotFoundException - If the RGB values need to be read from a file and this file(typically inferred from Palette.name) is not found. throws: IOException - If an other find of I/O error occured. throws: IIOException - If an other kind of error prevent this method to complete. |
getImage | public RenderedImage getImage(Dimension size) throws IOException(Code) | | Returns the color palette as an image of the specified size.
This is useful for looking visually at a color palette.
Parameters: size - The image size. The palette will be vertical ifsize. >size. throws: IOException - if the color values can't be read. |
getOffset | double getOffset()(Code) | | Returns the offset from normalized values (values in the range [0..1])
to values in the range of this palette.
|
getScale | double getScale()(Code) | | Returns the scale from normalized values (values in the range [0..1])
to values in the range of this palette.
|
hashCode | public int hashCode()(Code) | | Returns a hash value for this palette.
|
show | public void show() throws IOException(Code) | | Shows the palette in a windows. This is mostly for debugging purpose.
throws: IOException - if the color values can't be read. |
|
|