public class OctTreeQuantizer extends Object implements Quantizer
Modifier and Type | Class and Description |
---|---|
(package private) class |
OctTreeQuantizer.OctTreeNode
An Octtree node.
|
Modifier and Type | Field and Description |
---|---|
private Vector[] |
colorList |
private int |
colors |
(package private) static int |
MAX_LEVEL
The greatest depth the tree is allowed to reach
|
private int |
maximumColors |
private int |
nodes |
private int |
reduceColors |
private OctTreeQuantizer.OctTreeNode |
root |
Constructor and Description |
---|
OctTreeQuantizer() |
Modifier and Type | Method and Description |
---|---|
void |
addPixels(int[] pixels,
int offset,
int count)
Add pixels to the quantizer.
|
int[] |
buildColorTable()
Build the color table.
|
void |
buildColorTable(int[] inPixels,
int[] table)
A quick way to use the quantizer.
|
private int |
buildColorTable(OctTreeQuantizer.OctTreeNode node,
int[] table,
int index) |
int |
getIndexForColor(int rgb)
Get the color table index for a color.
|
private void |
insertColor(int rgb) |
private void |
reduceTree(int numColors) |
void |
setup(int numColors)
Initialize the quantizer.
|
static final int MAX_LEVEL
private int nodes
private OctTreeQuantizer.OctTreeNode root
private int reduceColors
private int maximumColors
private int colors
public OctTreeQuantizer()
public void setup(int numColors)
public void addPixels(int[] pixels, int offset, int count)
public int getIndexForColor(int rgb)
getIndexForColor
in interface Quantizer
rgb
- the colorprivate void insertColor(int rgb)
private void reduceTree(int numColors)
public int[] buildColorTable()
buildColorTable
in interface Quantizer
public void buildColorTable(int[] inPixels, int[] table)
inPixels
- the input colorstable
- the output color tableprivate int buildColorTable(OctTreeQuantizer.OctTreeNode node, int[] table, int index)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses