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)
77 lines (76 loc) • 2.89 kB
TypeScript
/** @format */
import { VP8L } from './vp8l.js';
import { VP8LTransform } from './vp8l-transform.js';
/**
* Internal operations for VP8L image decoding.
*/
export declare class VP8LInternal extends VP8L {
/** Array of VP8LTransform objects used for image transformations. */
get transforms(): VP8LTransform[];
/** Pixel data buffer. */
get pixels(): Uint32Array | undefined;
/** Opaque (alpha) channel data. */
get opaque(): Uint8Array | undefined;
set opaque(v: Uint8Array | undefined);
/** Width of the IO buffer. */
get ioWidth(): number;
set ioWidth(v: number);
/** Height of the IO buffer. */
get ioHeight(): number;
set ioHeight(v: number);
/**
* Decode image data using a processing function for each row.
* @param data - Image data buffer.
* @param width - Image width.
* @param height - Image height.
* @param lastRow - Last row index to process.
* @param processFunc - Function to process each row.
* @returns True if decoding succeeds.
*/
decodeImageData(data: Uint32Array, width: number, height: number, lastRow: number, processFunc: (_row: number, _waitForBiggestBatch: boolean) => void): boolean;
/**
* Decode the image stream to a pixel buffer.
* @param xsize - Image width.
* @param ysize - Image height.
* @param isLevel0 - If true, decode at level 0.
* @returns Decoded pixel buffer or undefined.
*/
decodeImageStream(xsize: number, ysize: number, isLevel0: boolean): Uint32Array | undefined;
/**
* Allocate internal 32-bit buffers.
* @param finalWidth - Final width for buffer allocation.
* @returns True if allocation succeeds.
*/
allocateInternalBuffers32b(finalWidth: number): boolean;
/**
* Allocate internal 8-bit buffers.
* @returns True if allocation succeeds.
*/
allocateInternalBuffers8b(): boolean;
/**
* Decode alpha (transparency) channel data.
* @param width - Image width.
* @param height - Image height.
* @param lastRow - Last row index to process.
* @returns True if decoding succeeds.
*/
decodeAlphaData(width: number, height: number, lastRow: number): boolean;
/**
* Check if 8-bit optimization can be applied.
* @returns True if optimization is possible.
*/
is8bOptimizable(): boolean;
/**
* Extract alpha rows for processing.
* @param row - Row index to extract.
* @param waitForBiggestBatch - If true, wait for the largest batch.
*/
extractAlphaRows(row: number, waitForBiggestBatch: boolean): void;
/**
* Calculate subsampled size for given sampling bits.
* @param size - Original size.
* @param samplingBits - Number of sampling bits.
* @returns Subsampled size.
*/
static subSampleSize(size: number, samplingBits: number): number;
}