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)

190 lines (189 loc) 4.31 kB
/** @format */ import { Color } from '../../color/color.js'; import { InputBuffer } from '../../common/input-buffer.js'; import { DecodeInfo } from '../decode-info.js'; import { TgaImageType } from './tga-image-type.js'; /** * Interface for TGA information initialization options. */ export interface TgaInfoInitOptions { /** * Width of the image. */ width?: number; /** * Height of the image. */ height?: number; /** * Offset in the input file where the image data starts. */ imageOffset?: number; /** * Bits per pixel of the image. */ bitsPerPixel?: number; } /** * Class representing TGA information. */ export declare class TgaInfo implements DecodeInfo { /** * The number of frames that can be decoded. */ private readonly _numFrames; /** * Gets the number of frames. */ get numFrames(): number; /** * The background color of the image. */ private readonly _backgroundColor; /** * Gets the background color. */ get backgroundColor(): Color | undefined; /** * The length of the ID field. */ private _idLength; /** * Gets the length of the ID field. */ get idLength(): number; /** * The type of the color map. */ private _colorMapType; /** * Gets the type of the color map. */ get colorMapType(): number; /** * The type of the image. */ private _imageType; /** * Gets the type of the image. */ get imageType(): TgaImageType; /** * The origin of the color map. */ private _colorMapOrigin; /** * Gets the origin of the color map. */ get colorMapOrigin(): number; /** * The length of the color map. */ private _colorMapLength; /** * Gets the length of the color map. */ get colorMapLength(): number; /** * The depth of the color map. */ private _colorMapDepth; /** * Gets the depth of the color map. */ get colorMapDepth(): number; /** * The X offset of the image. */ private _offsetX; /** * Gets the X offset of the image. */ get offsetX(): number; /** * The Y offset of the image. */ private _offsetY; /** * Gets the Y offset of the image. */ get offsetY(): number; /** * The width of the image. */ private _width; /** * Gets the width of the image. */ get width(): number; /** * The height of the image. */ protected _height: number; /** * Gets the height of the image. */ get height(): number; /** * The pixel depth of the image. */ protected _pixelDepth: number; /** * Gets the pixel depth of the image. */ get pixelDepth(): number; /** * The flags of the image. */ protected _flags: number; /** * Gets the flags of the image. */ get flags(): number; /** * The color map of the image. */ protected _colorMap: Uint8Array | undefined; /** * Gets the color map of the image. */ get colorMap(): Uint8Array | undefined; /** * Sets the color map of the image. */ set colorMap(v: Uint8Array | undefined); /** * The screen origin of the image. */ protected _screenOrigin: number; /** * Gets the screen origin of the image. */ get screenOrigin(): number; /** * Offset in the input file the image data starts at. */ private _imageOffset; /** * Gets the offset in the input file the image data starts at. */ get imageOffset(): number; /** * Sets the offset in the input file the image data starts at. */ set imageOffset(v: number); /** * Checks if the image has a color map. */ get hasColorMap(): boolean; /** * Reads the TGA header from the input buffer. * @param {InputBuffer<Uint8Array>} header - The input buffer containing the TGA header. */ read(header: InputBuffer<Uint8Array>): void; /** * Validates the TGA information. * @returns {boolean} True if the TGA information is valid, otherwise false. */ isValid(): boolean; }