import { ColorQuantizeFunction } from "./color-quantize-functions"; import { Options } from "./Options"; import { ColorCounts, RgbColor } from "./RgbColor"; export declare enum ColorDistanceBuffering { OFF = "off", ON = "on", REASONABLE = "reasonable" } type ImageColorIndex = number[][]; export declare class ColorIndex { rows: ImageColorIndex; palette: RgbColor[]; options: Options; verbose: boolean; constructor(imageData: ImageData, options: Options, quantizeFunction: ColorQuantizeFunction); /** * @param imageData * @returns */ protected buildPalette(imageData: ImageData, quantizeFunction: ColorQuantizeFunction): RgbColor[]; /** * Using a form of k-means clustering repeated options.colorClusteringCycles times. http://en.wikipedia.org/wiki/Color_quantization * * * @param imageData * @returns */ protected buildColorData(imageData: ImageData, palette: RgbColor[]): ImageColorIndex; protected runClusteringCycle(imageData: ImageData, palette: RgbColor[], isLastCycle: boolean): ImageColorIndex; protected colorIndexesEqual(i1: ImageColorIndex, i2: ImageColorIndex): boolean; protected adjustPaletteToColorAverages(palette: RgbColor[], colorCounters: ColorCounts, numPixels: number, isLastCycle: boolean): void; /** * Maps each pixel in the image to the palette index of the closest color. * * @param imageData * @param palette * @returns */ protected buildImageColorIndex(imageData: ImageData, palette: RgbColor[]): ImageColorIndex; protected buildImageColorIndexUnbuffered(imageData: ImageData, palette: RgbColor[]): ImageColorIndex; protected buildImageColorIndexBuffered(imageData: ImageData, palette: RgbColor[]): ImageColorIndex; protected getPixelColorId(imageData: ImageData, pixelOffset: number): number; protected initColorIndexArray(imgWidth: number, imgHeight: number): ImageColorIndex; protected buildColorCounts(imageData: ImageData, imageColorIndex: ImageColorIndex, numberOfColors: number): ColorCounts; protected initColorCounts(numberOfColors: number): ColorCounts; /** * find closest color from palette by measuring (rectilinear) color distance between this pixel and all palette colors * @param palette * @param color * @param pixelOffset * @returns */ protected findClosestPaletteColorIx(imageData: ImageData, pixelOffset: number, palette: RgbColor[]): number; } export {}; //# sourceMappingURL=ColorIndex.d.ts.map