接口 Quantizer
-
- 所有已知实现类:
OctTreeQuantizer
public interface QuantizerThe interface for an image quantizer. The addColor method is called (repeatedly if necessary) with all the image pixels. A color table can then be returned by calling the buildColorTable method.
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 voidaddPixels(int[] pixels, int offset, int count)Add pixels to the quantizer.int[]buildColorTable()Build a color table from the added pixels.intgetIndexForColor(int rgb)Using the previously-built color table, return the index into that table for a pixel.voidsetup(int numColors)Initialize the quantizer.
-
-
-
方法详细资料
-
setup
void setup(int numColors)
Initialize the quantizer. This should be called before adding any pixels.- 参数:
numColors- the number of colors we're quantizing to.
-
addPixels
void addPixels(int[] pixels, int offset, int count)Add pixels to the quantizer.- 参数:
pixels- the array of ARGB pixelsoffset- the offset into the arraycount- the count of pixels
-
buildColorTable
int[] buildColorTable()
Build a color table from the added pixels.- 返回:
- an array of ARGB pixels representing a color table
-
getIndexForColor
int getIndexForColor(int rgb)
Using the previously-built color table, return the index into that table for a pixel. This is guaranteed to return a valid index - returning the index of a color closer to that requested if necessary.- 参数:
rgb- the pixel to find- 返回:
- the pixel's index in the color table
-
-