Package com.jhlabs.image
Class OctTreeQuantizer
java.lang.Object
com.jhlabs.image.OctTreeQuantizer
- All Implemented Interfaces:
Quantizer
An image Quantizer based on the Octree algorithm. This is a very basic implementation
at present and could be much improved by picking the nodes to reduce more carefully
(i.e. not completely at random) when I get the time.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPixels
(int[] pixels, int offset, int count) Add pixels to the quantizer.int[]
void
buildColorTable
(int[] inPixels, int[] table) A quick way to use the quantizer.int
getIndexForColor
(int rgb) void
setup
(int numColors) Initialize the quantizer.
-
Constructor Details
-
OctTreeQuantizer
public OctTreeQuantizer()
-
-
Method Details
-
setup
public void setup(int numColors) Initialize the quantizer. This should be called before adding any pixels. -
addPixels
public void addPixels(int[] pixels, int offset, int count) Add pixels to the quantizer. -
getIndexForColor
public int getIndexForColor(int rgb) - Specified by:
getIndexForColor
in interfaceQuantizer
-
buildColorTable
public int[] buildColorTable()- Specified by:
buildColorTable
in interfaceQuantizer
-
buildColorTable
public void buildColorTable(int[] inPixels, int[] table) A quick way to use the quantizer. Just create a table the right size and pass in the pixels.
-