| java.lang.Object org.geotools.image.io.Palette org.geotools.image.io.IndexedPalette
IndexedPalette | final class IndexedPalette extends Palette (Code) | | A set of RGB colors created by a
from a name.
A palette can creates an
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
kb. 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: IndexedPalette.java 26708 2007-08-27 19:42:59Z desruisseaux $ author: Antoine Hnawia author: Martin Desruisseaux |
Field Summary | |
final protected int | lower Index of the first valid element (inclusive) in the
to be created. | final protected int | size The size of the
to be created.
This is the value to be returned by
IndexColorModel.getMapSize . | final protected int | upper Index of the last valid element (exclusive) in the
to be created. |
Constructor Summary | |
protected | IndexedPalette(PaletteFactory factory, String name, int lower, int upper, int size, int numBands, int visibleBand) Creates a palette with the specified name and size. |
Method Summary | |
public boolean | equals(Object object) Compares this palette with the specified object for equality. | public synchronized 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. | public String | toString() Returns a string representation of this palette. |
lower | final protected int lower(Code) | | Index of the first valid element (inclusive) in the
to be created. Pixels in the range 0 inclusive to
lower exclusive will be reserved for "no data" values.
Strictly speaking, this index should be non-negative because
IndexColorModel do not supports negative index. However this
Palette implementation accepts
negative values provided that
IndexedPalette.upper is not greater than
.
If this condition holds, then
Palette will transpose negative values as positive
values in the range
0x80000 to
0xFFFF inclusive. Be aware that such
approach consume the maximal amount of memory, i.e. 256 kilobytes for each color model.
|
size | final protected int size(Code) | | The size of the
to be created.
This is the value to be returned by
IndexColorModel.getMapSize . This
value is always positive.
|
upper | final protected int upper(Code) | | Index of the last valid element (exclusive) in the
to be created. Pixels in the range
upper inclusive
to
IndexedPalette.size exclusive will be reserved for "no data" values. This value
is always greater than
IndexedPalette.lower (note that it may be negative).
|
IndexedPalette | protected IndexedPalette(PaletteFactory factory, String name, int lower, int upper, int size, int numBands, int visibleBand)(Code) | | Creates a palette with the specified name and size. The RGB colors will be distributed
in the range
lower inclusive to
upper exclusive. Remaining pixel values
(if any) will be left to a black or transparent color by default.
Parameters: factory - The originating factory. Parameters: name - The palette name. Parameters: lower - Index of the first valid element (inclusive) in the to be created. Parameters: upper - Index of the last valid element (exclusive) in the to be created. Parameters: size - The size of the to be created.This is the value to be returned by IndexColorModel.getMapSize. Parameters: numBands - The number of bands (usually 1). Parameters: visibleBand - The band to use for color computations (usually 0). |
equals | public boolean equals(Object object)(Code) | | Compares this palette with the specified object for equality.
|
getImageTypeSpecifier | public synchronized ImageTypeSpecifier getImageTypeSpecifier() throws IOException(Code) | | Returns the image type specifier 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 ) 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. |
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.
|
toString | public String toString()(Code) | | Returns a string representation of this palette. Used for debugging purpose only.
|
|
|