package bmpviewer.bmp; /** * color(RGB 24-bit) counter. *
* generates color table.
* converts color to index.
*
* @author Hiroyuki Murata * @since JDK1.1 */ public class RGBCounter { private int[][][] tree; private int[] pix,tbl; private int lim,count, rrggbb,rr,gg,bb; /** * constructor *
* @param pix array of pixels.
* @param lim counter limit.
*/
public RGBCounter(int[] pix, int lim) {
this.pix = pix;
this.lim = lim;
tree = new int[256][][];
tbl = new int[lim+1];
}
//------------------------------------------------------
/**
* count number of colors
*/
public int count() {
for (int i=0; i