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)

161 lines (160 loc) 5.29 kB
/** @format */ import { Format } from '../color/format.js'; import { Palette } from './palette.js'; /** * Class representing a palette with 32-bit floating point colors. */ export declare class PaletteFloat32 implements Palette { /** * Internal storage for color data. * @private */ private readonly _data; /** * Gets the color data. * @returns {Float32Array} The color data. */ get data(): Float32Array; /** * Number of colors in the palette. * @private */ private readonly _numColors; /** * Gets the number of colors in the palette. * @returns {number} The number of colors. */ get numColors(): number; /** * Number of channels per color. * @private */ private readonly _numChannels; /** * Gets the number of channels per color. * @returns {number} The number of channels. */ get numChannels(): number; /** * Gets the byte length of the color data. * @returns {number} The byte length. */ get byteLength(): number; /** * Gets the buffer of the color data. * @returns {ArrayBufferLike} The buffer. */ get buffer(): ArrayBufferLike; /** * Gets the format of the palette. * @returns {Format} The format. */ get format(): Format; /** * Gets the maximum channel value. * @returns {number} The maximum channel value. */ get maxChannelValue(): number; /** * Creates an instance of PaletteFloat32. * @param {number} numColors - The number of colors. * @param {number} numChannels - The number of channels per color. * @param {Float32Array} [data] - Optional initial data. */ constructor(numColors: number, numChannels: number, data?: Float32Array); /** * Creates a new PaletteFloat32 from an existing one. * @param {PaletteFloat32} other - The existing palette. * @returns {PaletteFloat32} The new palette. */ static from(other: PaletteFloat32): PaletteFloat32; /** * Sets the RGB values for a specific color index. * @param {number} index - The color index. * @param {number} r - The red value. * @param {number} g - The green value. * @param {number} b - The blue value. */ setRgb(index: number, r: number, g: number, b: number): void; /** * Sets the RGBA values for a specific color index. * @param {number} index - The color index. * @param {number} r - The red value. * @param {number} g - The green value. * @param {number} b - The blue value. * @param {number} a - The alpha value. */ setRgba(index: number, r: number, g: number, b: number, a: number): void; /** * Sets the value of a specific channel for a specific color index. * @param {number} index - The color index. * @param {number} channel - The channel index. * @param {number} value - The value to set. */ set(index: number, channel: number, value: number): void; /** * Gets the value of a specific channel for a specific color index. * @param {number} index - The color index. * @param {number} channel - The channel index. * @returns {number} The value of the channel. */ get(index: number, channel: number): number; /** * Gets the red value for a specific color index. * @param {number} index - The color index. * @returns {number} The red value. */ getRed(index: number): number; /** * Gets the green value for a specific color index. * @param {number} index - The color index. * @returns {number} The green value. */ getGreen(index: number): number; /** * Gets the blue value for a specific color index. * @param {number} index - The color index. * @returns {number} The blue value. */ getBlue(index: number): number; /** * Gets the alpha value for a specific color index. * @param {number} index - The color index. * @returns {number} The alpha value. */ getAlpha(index: number): number; /** * Sets the red value for a specific color index. * @param {number} index - The color index. * @param {number} value - The red value. */ setRed(index: number, value: number): void; /** * Sets the green value for a specific color index. * @param {number} index - The color index. * @param {number} value - The green value. */ setGreen(index: number, value: number): void; /** * Sets the blue value for a specific color index. * @param {number} index - The color index. * @param {number} value - The blue value. */ setBlue(index: number, value: number): void; /** * Sets the alpha value for a specific color index. * @param {number} index - The color index. * @param {number} value - The alpha value. */ setAlpha(index: number, value: number): void; /** * Creates a clone of the current palette. * @returns {PaletteFloat32} The cloned palette. */ clone(): PaletteFloat32; /** * Converts the palette to a Uint8Array. * @returns {Uint8Array} The Uint8Array representation of the palette. */ toUint8Array(): Uint8Array; }