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)

61 lines (60 loc) 2.3 kB
/** @format */ import { Decoder, DecoderDecodeOptions } from './decoder.js'; import { IcoInfo } from './ico/ico-info.js'; import { MemoryImage } from '../image/image.js'; import { ImageFormat } from './image-format.js'; /** * Class representing an ICO decoder. */ export declare class IcoDecoder implements Decoder { /** * Input buffer for the ICO file. */ private _input?; /** * Information about the ICO file. */ private _info?; /** * Gets the image format. * @returns {ImageFormat} The image format. */ get format(): ImageFormat; /** * Gets the number of frames in the ICO file. * @returns {number} The number of frames. */ get numFrames(): number; /** * Checks if the provided bytes represent a valid ICO file. * @param {Uint8Array} bytes - The bytes to check. * @returns {boolean} True if the bytes represent a valid ICO file, false otherwise. */ isValidFile(bytes: Uint8Array): boolean; /** * Starts decoding the ICO file. * @param {Uint8Array} bytes - The bytes of the ICO file. * @returns {IcoInfo | undefined} The information about the ICO file, or undefined if invalid. */ startDecode(bytes: Uint8Array): IcoInfo | undefined; /** * Decodes the ICO file into a MemoryImage. * @param {DecoderDecodeOptions} opt - The decode options. * @param {Uint8Array} opt.bytes - The bytes of the ICO file. * @param {number} [opt.frameIndex] - The index of the frame to decode. * @returns {MemoryImage | undefined} The decoded MemoryImage, or undefined if decoding failed. */ decode(opt: DecoderDecodeOptions): MemoryImage | undefined; /** * Decodes a specific frame of the ICO file. * @param {number} frameIndex - The index of the frame to decode. * @returns {MemoryImage | undefined} The decoded MemoryImage, or undefined if decoding failed. */ decodeFrame(frameIndex: number): MemoryImage | undefined; /** * Decodes the largest frame in the ICO file. * @param {Uint8Array} bytes - The bytes of the ICO file. * @returns {MemoryImage | undefined} The decoded MemoryImage, or undefined if decoding failed. */ decodeImageLargest(bytes: Uint8Array): MemoryImage | undefined; }