image-in-browser
Version:
Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)
58 lines (57 loc) • 1.98 kB
TypeScript
/** @format */
import { Color } from '../color/color.js';
import { MemoryImage } from './image.js';
import { Palette } from './palette.js';
import { Quantizer } from './quantizer.js';
/**
* A class that implements the Quantizer interface to perform binary quantization.
*/
export declare class BinaryQuantizer implements Quantizer {
/**
* The palette used for quantization.
*/
private readonly _palette;
/**
* Gets the palette used for quantization.
*/
get palette(): Palette;
/**
* The threshold value for binary quantization.
*/
private readonly _threshold;
/**
* Gets the threshold value for binary quantization.
*/
get threshold(): number;
/**
* Constructs a BinaryQuantizer with an optional threshold value.
* @param {number} threshold - The threshold value for binary quantization. Default is 0.5.
*/
constructor(threshold?: number);
/**
* Gets the color index based on the luminance of the color.
* @param {Color} c - The color to be quantized.
* @returns {number} The color index (0 or 1).
*/
getColorIndex(c: Color): number;
/**
* Gets the color index based on the RGB values.
* @param {number} r - The red component of the color.
* @param {number} g - The green component of the color.
* @param {number} b - The blue component of the color.
* @returns {number} The color index (0 or 1).
*/
getColorIndexRgb(r: number, g: number, b: number): number;
/**
* Gets the quantized color based on the luminance of the input color.
* @param {Color} c - The color to be quantized.
* @returns {Color} The quantized color.
*/
getQuantizedColor(c: Color): Color;
/**
* Converts the image to a palette image.
* @param {MemoryImage} image - The image to be converted.
* @returns {MemoryImage} The palette image.
*/
getIndexImage(image: MemoryImage): MemoryImage;
}