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.17 kB
TypeScript
/** @format */
import { Format } from '../color/format.js';
import { Palette } from './palette.js';
/**
* Class representing a palette of 32-bit integers.
*/
export declare class PaletteInt32 implements Palette {
/**
* The internal data storage for the palette.
*/
private readonly _data;
/**
* Gets the internal data storage for the palette.
* @returns {Int32Array} The internal data storage.
*/
get data(): Int32Array;
/**
* The 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;
/**
* The 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 storage.
* @returns {number} The byte length.
*/
get byteLength(): number;
/**
* Gets the buffer of the internal data storage.
* @returns {ArrayBufferLike} The buffer.
*/
get buffer(): ArrayBufferLike;
/**
* Gets the format of the palette.
* @returns {Format} The format.
*/
get format(): Format;
/**
* Gets the maximum value for a channel.
* @returns {number} The maximum channel value.
*/
get maxChannelValue(): number;
/**
* Creates an instance of PaletteInt32.
* @param {number} numColors - The number of colors.
* @param {number} numChannels - The number of channels per color.
* @param {Int32Array} [data] - Optional initial data.
*/
constructor(numColors: number, numChannels: number, data?: Int32Array);
/**
* Creates a new instance of PaletteInt32 from another instance.
* @param {PaletteInt32} other - The other instance.
* @returns {PaletteInt32} A new instance.
*/
static from(other: PaletteInt32): PaletteInt32;
/**
* Sets the RGB values for a specific index.
* @param {number} index - The 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 index.
* @param {number} index - The 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 for a specific channel at a specific index.
* @param {number} index - The index.
* @param {number} channel - The channel.
* @param {number} value - The value.
*/
set(index: number, channel: number, value: number): void;
/**
* Gets the value for a specific channel at a specific index.
* @param {number} index - The index.
* @param {number} channel - The channel.
* @returns {number} The value.
*/
get(index: number, channel: number): number;
/**
* Gets the red value for a specific index.
* @param {number} index - The index.
* @returns {number} The red value.
*/
getRed(index: number): number;
/**
* Gets the green value for a specific index.
* @param {number} index - The index.
* @returns {number} The green value.
*/
getGreen(index: number): number;
/**
* Gets the blue value for a specific index.
* @param {number} index - The index.
* @returns {number} The blue value.
*/
getBlue(index: number): number;
/**
* Gets the alpha value for a specific index.
* @param {number} index - The index.
* @returns {number} The alpha value.
*/
getAlpha(index: number): number;
/**
* Sets the red value for a specific index.
* @param {number} index - The index.
* @param {number} value - The red value.
*/
setRed(index: number, value: number): void;
/**
* Sets the green value for a specific index.
* @param {number} index - The index.
* @param {number} value - The green value.
*/
setGreen(index: number, value: number): void;
/**
* Sets the blue value for a specific index.
* @param {number} index - The index.
* @param {number} value - The blue value.
*/
setBlue(index: number, value: number): void;
/**
* Sets the alpha value for a specific index.
* @param {number} index - The index.
* @param {number} value - The alpha value.
*/
setAlpha(index: number, value: number): void;
/**
* Creates a clone of the current instance.
* @returns {PaletteInt32} A new instance that is a clone of the current instance.
*/
clone(): PaletteInt32;
/**
* Converts the internal data storage to a Uint8Array.
* @returns {Uint8Array} The Uint8Array representation of the internal data.
*/
toUint8Array(): Uint8Array;
}