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)
158 lines (157 loc) • 5.26 kB
TypeScript
/** @format */
import { Format } from '../color/format.js';
import { Palette } from './palette.js';
/**
* Class representing a palette with Int16 values.
*/
export declare class PaletteInt16 implements Palette {
/**
* Internal data storage for the palette.
*/
private readonly _data;
/**
* Gets the internal data array.
* @returns {Int16Array} The internal data array.
*/
get data(): Int16Array;
/**
* Number of colors in the palette.
*/
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 readonly _numChannels;
/**
* Gets the number of channels per color.
* @returns {number} The number of channels.
*/
get numChannels(): number;
/**
* Gets the byte length of the internal data array.
* @returns {number} The byte length.
*/
get byteLength(): number;
/**
* Gets the buffer of the internal data array.
* @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 PaletteInt16.
* @param {number} numColors - The number of colors.
* @param {number} numChannels - The number of channels per color.
* @param {Int16Array} [data] - Optional initial data array.
*/
constructor(numColors: number, numChannels: number, data?: Int16Array);
/**
* Creates a new PaletteInt16 instance from another instance.
* @param {PaletteInt16} other - The other PaletteInt16 instance.
* @returns {PaletteInt16} A new PaletteInt16 instance.
*/
static from(other: PaletteInt16): PaletteInt16;
/**
* Sets the RGB values at a specific index.
* @param {number} index - The index to set.
* @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 at a specific index.
* @param {number} index - The index to set.
* @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 at a specific index.
* @param {number} index - The index to set.
* @param {number} channel - The channel to set.
* @param {number} value - The value to set.
*/
set(index: number, channel: number, value: number): void;
/**
* Gets the value of a specific channel at a specific index.
* @param {number} index - The index to get.
* @param {number} channel - The channel to get.
* @returns {number} The value of the channel.
*/
get(index: number, channel: number): number;
/**
* Gets the red value at a specific index.
* @param {number} index - The index to get.
* @returns {number} The red value.
*/
getRed(index: number): number;
/**
* Gets the green value at a specific index.
* @param {number} index - The index to get.
* @returns {number} The green value.
*/
getGreen(index: number): number;
/**
* Gets the blue value at a specific index.
* @param {number} index - The index to get.
* @returns {number} The blue value.
*/
getBlue(index: number): number;
/**
* Gets the alpha value at a specific index.
* @param {number} index - The index to get.
* @returns {number} The alpha value.
*/
getAlpha(index: number): number;
/**
* Sets the red value at a specific index.
* @param {number} index - The index to set.
* @param {number} value - The red value to set.
*/
setRed(index: number, value: number): void;
/**
* Sets the green value at a specific index.
* @param {number} index - The index to set.
* @param {number} value - The green value to set.
*/
setGreen(index: number, value: number): void;
/**
* Sets the blue value at a specific index.
* @param {number} index - The index to set.
* @param {number} value - The blue value to set.
*/
setBlue(index: number, value: number): void;
/**
* Sets the alpha value at a specific index.
* @param {number} index - The index to set.
* @param {number} value - The alpha value to set.
*/
setAlpha(index: number, value: number): void;
/**
* Creates a clone of the current PaletteInt16 instance.
* @returns {PaletteInt16} A new PaletteInt16 instance.
*/
clone(): PaletteInt16;
/**
* Converts the internal data to a Uint8Array.
* @returns {Uint8Array} The Uint8Array representation of the data.
*/
toUint8Array(): Uint8Array;
}