public class ColorMapUtilities extends Object
Constructor and Description |
---|
ColorMapUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
expand(Color[] colors,
int[] ARGB,
int lower,
int upper)
Copies
colors into array ARGB from index lower inclusive to index upper exclusive. |
static int |
getBitCount(int mapSize)
Returns a bit count for an
IndexColorModel mapping mapSize colors. |
static int |
getTransferType(int mapSize)
Returns a suggered type for an
IndexColorModel of mapSize colors. |
static int |
roundByte(double value)
Rounds a float value and clamp the result between 0 and 255 inclusive.
|
public static void expand(Color[] colors, int[] ARGB, int lower, int upper)
colors
into array ARGB
from index lower
inclusive to index upper
exclusive. If upper-lower
is
not equals to the length of colors
array, then colors will be interpolated.
Note: Profiling shows that this method is a "hot spot". It needs to be fast, which is why the implementation is not as straight-forward as it could.
colors
- Colors to copy into the ARGB
array.ARGB
- Array of integer to write ARGB values to.lower
- Index (inclusive) of the first element of ARGB
to change.upper
- Index (exclusive) of the last element of ARGB
to change.public static int roundByte(double value)
public static int getBitCount(int mapSize)
IndexColorModel
mapping mapSize
colors. It is guaranteed that the following relation is hold:
(1 << getBitCount(mapSize)) >= mapSize
public static int getTransferType(int mapSize)
IndexColorModel
of mapSize
colors. This method returns DataBuffer.TYPE_BYTE
or
DataBuffer.TYPE_USHORT
.Copyright © 2006–2015 GeoSolutions. All rights reserved.