UNPKG

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)

120 lines (119 loc) 3.8 kB
/** @format */ import { ColorUint8 } from '../../color/color-uint8.js'; import { PaletteUint8 } from '../../image/palette-uint8.js'; /** * Class representing a GIF color map. */ export declare class GifColorMap { /** * Number of colors in the color map. */ private readonly _numColors; /** * Gets the number of colors. * @returns {number} The number of colors. */ get numColors(): number; /** * The palette used in the color map. */ private readonly _palette; /** * Gets the palette. * @returns {PaletteUint8} The palette. */ get palette(): PaletteUint8; /** * Bits per pixel. */ private _bitsPerPixel; /** * Gets the bits per pixel. * @returns {number} The bits per pixel. */ get bitsPerPixel(): number; /** * Transparent color index. */ private _transparent?; /** * Sets the transparent color index. * @param {number | undefined} v - The transparent color index. */ set transparent(v: number | undefined); /** * Gets the transparent color index. * @returns {number | undefined} The transparent color index. */ get transparent(): number | undefined; /** * Creates an instance of GifColorMap. * @param {number} numColors - The number of colors. * @param {PaletteUint8} [palette] - The palette. */ constructor(numColors: number, palette?: PaletteUint8); /** * Calculates the bit size required for the given number of colors. * @param {number} n - The number of colors. * @returns {number} The bit size. */ private static bitSize; /** * Creates a new GifColorMap from an existing one. * @param {GifColorMap} other - The existing GifColorMap. * @returns {GifColorMap} The new GifColorMap. */ static from(other: GifColorMap): GifColorMap; /** * Gets the color at the specified index. * @param {number} index - The index. * @returns {ColorUint8} The color. */ getColor(index: number): ColorUint8; /** * Sets the color at the specified index. * @param {number} index - The index. * @param {number} r - The red component. * @param {number} g - The green component. * @param {number} b - The blue component. */ setColor(index: number, r: number, g: number, b: number): void; /** * Finds the closest color index for the given RGBA values. * @param {number} r - The red component. * @param {number} g - The green component. * @param {number} b - The blue component. * @param {number} a - The alpha component. * @returns {number} The closest color index. */ findColor(r: number, g: number, b: number, a: number): number; /** * Gets the red component of the color at the specified index. * @param {number} color - The color index. * @returns {number} The red component. */ getRed(color: number): number; /** * Gets the green component of the color at the specified index. * @param {number} color - The color index. * @returns {number} The green component. */ getGreen(color: number): number; /** * Gets the blue component of the color at the specified index. * @param {number} color - The color index. * @returns {number} The blue component. */ getBlue(color: number): number; /** * Gets the alpha component of the color at the specified index. * @param {number} color - The color index. * @returns {number} The alpha component. */ getAlpha(color: number): number; /** * Gets the palette with RGBA values. * @returns {PaletteUint8} The palette with RGBA values. */ getPalette(): PaletteUint8; }