public class OctreeNode extends java.lang.Object implements ComparatorInterface, RGBIndex
OctreeColorQuantizer
Modifier and Type | Field and Description |
---|---|
private int |
blue |
private int |
blueSum |
private OctreeNode[] |
children |
private int |
green |
private int |
greenSum |
private int |
paletteIndex |
private int |
pixelCount |
private int |
red |
private int |
redSum |
INDEX_BLUE, INDEX_GREEN, INDEX_RED
Constructor and Description |
---|
OctreeNode() |
Modifier and Type | Method and Description |
---|---|
static boolean |
add(OctreeNode root,
int red,
int green,
int blue,
int bitsPerSample)
Add a color red-green-blue to the octree, given by its root node.
|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compares the two argument objects and returns their relation.
|
private static int |
computeIndex(int red,
int green,
int blue,
int shift) |
void |
copyChildSums()
Adds the sums for red, green and blue values and
the pixel count values of all child nodes and
stores the results in this node.
|
void |
determineRepresentativeColor() |
int |
getBlue() |
OctreeNode[] |
getChildren() |
int |
getGreen() |
int |
getNumChildren() |
int |
getPaletteIndex() |
int |
getRed() |
boolean |
isLeaf() |
int |
map(int[] origRgb,
int[] quantizedRgb)
Returns the index of the best match for origRgb in the palette or
-1 if the best match could not be determined.
|
private int |
map(int r,
int g,
int b,
int shift,
int[] quantizedRgb) |
void |
setChildren(OctreeNode[] newChildren) |
void |
setPaletteIndex(int index) |
private void |
update(int red,
int green,
int blue) |
private int paletteIndex
private int pixelCount
private int redSum
private int greenSum
private int blueSum
private int red
private int green
private int blue
private OctreeNode[] children
public static boolean add(OctreeNode root, int red, int green, int blue, int bitsPerSample)
root
- root node of the octreered
- the red intensity value of the color to be addedgreen
- the green intensity value of the color to be addedblue
- the blue intensity value of the color to be addedbitsPerSample
- public int compare(java.lang.Object o1, java.lang.Object o2)
ComparatorInterface
o1
is smaller than o2
,o1
is equal to o2
ando1
is greater than o2
.compare
in interface ComparatorInterface
private static int computeIndex(int red, int green, int blue, int shift)
public void copyChildSums()
public void determineRepresentativeColor()
public int getBlue()
public OctreeNode[] getChildren()
public int getGreen()
public int getNumChildren()
public int getPaletteIndex()
public int getRed()
public boolean isLeaf()
public int map(int[] origRgb, int[] quantizedRgb)
private final int map(int r, int g, int b, int shift, int[] quantizedRgb)
public void setChildren(OctreeNode[] newChildren)
public void setPaletteIndex(int index)
private void update(int red, int green, int blue)