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)

71 lines (70 loc) 2.51 kB
/** @format */ import { MemoryImage } from '../image/image.js'; import { Decoder, DecoderDecodeOptions } from './decoder.js'; import { ImageFormat } from './image-format.js'; import { TgaInfo } from './tga/tga-info.js'; /** * Decode a TGA image. This only supports the 24-bit and 32-bit uncompressed format. */ export declare class TgaDecoder implements Decoder { /** * Input buffer for the TGA image. */ private _input; /** * Information about the TGA image. */ private _info; /** * Get the image format. * @returns {ImageFormat} The image format. */ get format(): ImageFormat; /** * Get the number of frames in the image. * @returns {number} The number of frames. */ get numFrames(): number; /** * Decode the color map of the TGA image. * @param {Uint8Array} colorMap - The color map data. * @param {Palette} palette - The palette to store the decoded colors. */ private decodeColorMap; /** * Decode the RLE compressed TGA image. * @returns {MemoryImage | undefined} The decoded image or undefined if decoding fails. */ private decodeRle; /** * Decode the RGB TGA image. * @returns {MemoryImage | undefined} The decoded image or undefined if decoding fails. */ private decodeRgb; /** * Is the given file a valid TGA image? * @param {Uint8Array} bytes - The file data. * @returns {boolean} True if the file is a valid TGA image, false otherwise. */ isValidFile(bytes: Uint8Array): boolean; /** * Start decoding the TGA image. * @param {Uint8Array} bytes - The file data. * @returns {TgaInfo | undefined} The TGA image information or undefined if decoding fails. */ startDecode(bytes: Uint8Array): TgaInfo | undefined; /** * Decode the TGA image. * @param {DecoderDecodeOptions} opt - The decode options. * @param {Uint8Array} opt.bytes - The file data. * @param {number} [opt.frameIndex] - The frame index to decode. * @returns {MemoryImage | undefined} The decoded image or undefined if decoding fails. */ decode(opt: DecoderDecodeOptions): MemoryImage | undefined; /** * Decode a specific frame of the TGA image. * @param {number} _frameIndex - The frame index to decode. * @returns {MemoryImage | undefined} The decoded image or undefined if decoding fails. */ decodeFrame(_frameIndex: number): MemoryImage | undefined; }