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)

66 lines (65 loc) 2.36 kB
/** @format */ import { InputBuffer } from '../common/input-buffer.js'; import { MemoryImage } from '../image/image.js'; import { BmpInfo } from './bmp/bmp-info.js'; import { Decoder, DecoderDecodeOptions } from './decoder.js'; import { ImageFormat } from './image-format.js'; /** * Class representing a BMP decoder. */ export declare class BmpDecoder implements Decoder { /** * Input buffer for the BMP data. */ protected _input?: InputBuffer<Uint8Array>; /** * Information about the BMP file. */ protected _info?: BmpInfo; /** * Flag to force RGBA format. */ protected _forceRgba: boolean; /** * Get the image format. * @returns {ImageFormat} The image format. */ get format(): ImageFormat; /** * Get the number of frames in the BMP image. * @returns {number} The number of frames. */ get numFrames(): number; /** * Create a BMP decoder. * @param {boolean} [forceRgba=false] - Flag to force RGBA format. */ constructor(forceRgba?: boolean); /** * Check if the given file is a valid BMP image. * @param {Uint8Array} bytes - The file bytes. * @returns {boolean} True if the file is a valid BMP image, false otherwise. */ isValidFile(bytes: Uint8Array): boolean; /** * Start decoding the BMP file. * @param {Uint8Array} bytes - The file bytes. * @returns {BmpInfo | undefined} The BMP information or undefined if invalid. */ startDecode(bytes: Uint8Array): BmpInfo | undefined; /** * Decode a single frame from the BMP file. * @param {number} _frameIndex - The index of the frame to decode. * @returns {MemoryImage | undefined} The decoded image or undefined if there was an error. */ decodeFrame(_frameIndex: number): MemoryImage | undefined; /** * Decode the BMP file and extract a single image from it. * If the file is animated, the specified frameIndex will be decoded. * @param {DecoderDecodeOptions} opt - The decode options. * @param {Uint8Array} opt.bytes - The file bytes. * @param {number} [opt.frameIndex=0] - The index of the frame to decode. * @returns {MemoryImage | undefined} The decoded image or undefined if there was an error. */ decode(opt: DecoderDecodeOptions): MemoryImage | undefined; }