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)
143 lines (142 loc) • 4.17 kB
TypeScript
/** @format */
import { Color } from '../../color/color.js';
import { InputBuffer } from '../../common/input-buffer.js';
import { PaletteUint8 } from '../../image/palette-uint8.js';
import { DecodeInfo } from '../decode-info.js';
import { BmpCompressionMode } from './bmp-compression-mode.js';
import { BmpFileHeader } from './bmp-file-header.js';
/**
* Class representing BMP information and decoding logic.
*/
export declare class BmpInfo implements DecodeInfo {
private readonly _startPos;
private _redShift;
private _redScale;
private _greenShift;
private _greenScale;
private _blueShift;
private _blueScale;
private _alphaShift;
private _alphaScale;
private readonly _width;
/**
* Gets the width of the BMP image.
*/
get width(): number;
protected readonly _height: number;
/**
* Gets the height of the BMP image.
*/
get height(): number;
private readonly _backgroundColor;
/**
* Gets the background color of the BMP image.
*/
get backgroundColor(): Color | undefined;
private readonly _numFrames;
/**
* Gets the number of frames in the BMP image.
*/
get numFrames(): number;
private readonly _header;
/**
* Gets the BMP file header.
*/
get header(): BmpFileHeader;
private readonly _headerSize;
/**
* Gets the size of the BMP header.
*/
get headerSize(): number;
private readonly _planes;
/**
* Gets the number of planes in the BMP image.
*/
get planes(): number;
private readonly _bitsPerPixel;
/**
* Gets the bits per pixel of the BMP image.
*/
get bitsPerPixel(): number;
private readonly _compression;
/**
* Gets the compression mode of the BMP image.
*/
get compression(): BmpCompressionMode;
private readonly _imageSize;
/**
* Gets the size of the BMP image.
*/
get imageSize(): number;
private readonly _xppm;
/**
* Gets the horizontal resolution (pixels per meter) of the BMP image.
*/
get xppm(): number;
private readonly _yppm;
/**
* Gets the vertical resolution (pixels per meter) of the BMP image.
*/
get yppm(): number;
private readonly _totalColors;
/**
* Gets the total number of colors in the BMP image.
*/
get totalColors(): number;
private readonly _importantColors;
/**
* Gets the number of important colors in the BMP image.
*/
get importantColors(): number;
private _redMask;
/**
* Gets the red mask value.
*/
get redMask(): number;
private _greenMask;
/**
* Gets the green mask value.
*/
get greenMask(): number;
private _blueMask;
/**
* Gets the blue mask value.
*/
get blueMask(): number;
private _alphaMask;
/**
* Gets the alpha mask value.
*/
get alphaMask(): number;
private _palette;
/**
* Gets the palette of the BMP image.
*/
get palette(): PaletteUint8 | undefined;
/**
* Determines if the BMP image is read bottom-up.
*/
get readBottomUp(): boolean;
/**
* Determines if the alpha channel should be ignored.
*/
get ignoreAlphaChannel(): boolean;
/**
* Initializes a new instance of the BmpInfo class.
* @param {InputBuffer<Uint8Array>} p - The input buffer.
* @param {BmpFileHeader} [header] - Optional BMP file header.
*/
constructor(p: InputBuffer<Uint8Array>, header?: BmpFileHeader);
/**
* Reads the palette from the input buffer.
* @param {InputBuffer<Uint8Array>} input - The input buffer.
*/
private readPalette;
/**
* Decodes a pixel from the input buffer.
* @param {InputBuffer<Uint8Array>} input - The input buffer.
* @param {(r: number, g: number, b: number, a: number) => void} pixel - The callback function to handle the decoded pixel.
* @throws {LibError} Throws an error if the bitsPerPixel or compression is unsupported.
*/
decodePixel(input: InputBuffer<Uint8Array>, pixel: (r: number, g: number, b: number, a: number) => void): void;
}