public class IndexImage
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
IndexImage.Counter
Used to track a color and the number of pixels of that colors
|
private static class |
IndexImage.Cube
Used to define a cube of the colorspace.
|
Constructor and Description |
---|
IndexImage() |
Modifier and Type | Method and Description |
---|---|
(package private) static byte[][] |
computeRGB(int nCubes,
IndexImage.Cube[] cubes)
create an array of rgb-colors from the cubes-array.
|
(package private) static IndexImage.Counter[][] |
convertColorList(java.util.List[] colors)
step 2: convert the result of step 1 to an Cube[][] which is
more efficient in the following iterations.
|
(package private) static java.util.List[] |
createColorList(java.awt.image.BufferedImage bi)
step 1: fill a data-structure with the count of each color in the image.
|
static java.awt.image.BufferedImage |
getIndexedImage(java.awt.image.BufferedImage bi,
int nColors)
Converts the input image (must be TYPE_INT_RGB or
TYPE_INT_ARGB) to an indexed image.
|
(package private) static void |
logRGB(byte[] r,
byte[] g,
byte[] b)
helper-method to print the complete rgb-arrays.
|
static byte[][] computeRGB(int nCubes, IndexImage.Cube[] cubes)
nCubes
- number of entries to use in cubescubes
- contains the Cubes resulting from running the split-algorithm.static void logRGB(byte[] r, byte[] g, byte[] b)
r
- g
- b
- static java.util.List[] createColorList(java.awt.image.BufferedImage bi)
bi
- input-imagestatic IndexImage.Counter[][] convertColorList(java.util.List[] colors)
colors
- the data-structure to convert. Note that it is
empty after conversion!public static java.awt.image.BufferedImage getIndexedImage(java.awt.image.BufferedImage bi, int nColors)
bi
- the image to be processed.nColors
- number of colors in the palette