|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.resources.image.ColorUtilities
A set of static methods for handling of colors informations. Some of those methods are useful, but not really rigorous. This is why they do not appear in any "official" package, but instead in this private one. Do not rely on this API! It may change in incompatible way in any future version.
Method Summary | |
static void |
expand(java.awt.Color[] colors,
int[] ARGB,
int lower,
int upper)
Copy into array from index inclusive to index exclusive. |
static int |
getBitCount(int mapSize)
Returns a bit count for an IndexColorModel mapping colors.
|
static int |
getColorIndex(java.awt.image.IndexColorModel colors,
java.awt.Color color,
int exclude)
Returns the index of the specified color, excluding the specified one. |
static java.awt.image.IndexColorModel |
getIndexColorModel(int[] ARGB)
Returns an index color model for specified ARGB codes. |
static java.awt.image.IndexColorModel |
getIndexColorModel(int[] ARGB,
int numBands,
int visibleBand)
Returns a tolerant index color model for the specified ARGB code. |
static int |
getNumBands(java.awt.image.ColorModel model)
Tries to guess the number of bands from the specified color model. |
static int |
getTransparentPixel(java.awt.image.IndexColorModel colors)
Returns the most transparent pixel in the specified color model. |
static java.awt.Color[] |
subarray(java.awt.Color[] palette,
int lower,
int upper)
Returns a subarray of the specified color array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.awt.Color[] subarray(java.awt.Color[] palette, int lower, int upper)
SampleDimension
as an heuristic
approach for distributing palette colors into a list of categories.
palette
- The color array (may be ).lower
- The lower index, inclusive.upper
- The upper index, inclusive.
public static void expand(java.awt.Color[] colors, int[] ARGB, int lower, int upper)
colors
- Colors to copy into the array.ARGB
- Array of integer to write ARGB values to.lower
- Index (inclusive) of the first element of to change.upper
- Index (exclusive) of the last element of to change.public static java.awt.image.IndexColorModel getIndexColorModel(int[] ARGB)
ARGB
- An array of ARGB values.
public static java.awt.image.IndexColorModel getIndexColorModel(int[] ARGB, int numBands, int visibleBand)
ARGB
- An array of ARGB values.numBands
- The number of bands.visibleBand
- The band to display.
public static int getBitCount(int mapSize)
IndexColorModel
mapping colors.
It is guaranteed that the following relation is hold:
(1 << getBitCount(mapSize)) >= mapSize
public static int getTransparentPixel(java.awt.image.IndexColorModel colors)
colors
- The color model in which to look for a transparent color.
public static int getColorIndex(java.awt.image.IndexColorModel colors, java.awt.Color color, int exclude)
colors
- The color model in which to look for a color index.color
- The color to search for.exclude
- An index to exclude from the search (usually the background or the
transparent pixel), or -1 if none.
public static int getNumBands(java.awt.image.ColorModel model)
SampleModel.getNumBands()
. This method should be used only
as a fallback when the sample model is not available. This method uses some heuristic rules
for guessing the number of bands, so the return value may not be exact in all cases.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |