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)

129 lines (128 loc) 3.94 kB
/** @format */ import { InputBuffer } from './input-buffer.js'; /** * Interface for initializing OutputBuffer options. */ export interface OutputBufferInitOptions { /** * Indicates if the buffer should use big-endian byte order. */ bigEndian?: boolean; /** * Initial size of the buffer. */ size?: number; } /** * Class representing a buffer for output operations. */ export declare class OutputBuffer { /** * Default block size for the buffer. */ private static readonly _blockSize; /** * Internal buffer storage. */ private _buffer; /** * Gets the internal buffer. */ get buffer(): Uint8Array; /** * Indicates if the buffer uses big-endian byte order. */ private _bigEndian; /** * Gets the big-endian flag. */ get bigEndian(): boolean; /** * Sets the big-endian flag. */ set bigEndian(v: boolean); /** * Current length of the buffer. */ private _length; /** * Gets the current length of the buffer. */ get length(): number; /** * Sets the current length of the buffer. */ set length(v: number); /** * Constructs an OutputBuffer instance. * * @param {OutputBufferInitOptions} [opt] - Optional initialization options. * @param {boolean} [opt.bigEndian=false] - Indicates if the buffer should use big-endian byte order. * @param {number} [opt.size=OutputBuffer._blockSize] - The initial size of the buffer. */ constructor(opt?: OutputBufferInitOptions); /** * Grow the buffer to accommodate additional data. * @param {number} required - The required additional size. */ private expandBuffer; /** * Rewind the buffer to the beginning. */ rewind(): void; /** * Clear the buffer. */ clear(): void; /** * Get the resulting bytes from the buffer. * @returns {Uint8Array} A Uint8Array containing the bytes in the buffer. */ getBytes(): Uint8Array; /** * Write a byte to the end of the buffer. * @param {number} value - The byte value to write. */ writeByte(value: number): void; /** * Write a set of bytes to the end of the buffer. * @param {Uint8Array} bytes - The bytes to write. * @param {number} [length] - The number of bytes to write. */ writeBytes(bytes: Uint8Array, length?: number): void; /** * Write the contents of another buffer to the end of this buffer. * @param {InputBuffer<Uint8Array>} bytes - The InputBuffer to write from. */ writeBuffer(bytes: InputBuffer<Uint8Array>): void; /** * Write a 16-bit word to the end of the buffer. * @param {number} value - The 16-bit word to write. */ writeUint16(value: number): void; /** * Write a 32-bit word to the end of the buffer. * @param {number} value - The 32-bit word to write. */ writeUint32(value: number): void; /** * Write a 32-bit float value to the end of the buffer. * @param {number} value - The 32-bit float value to write. */ writeFloat32(value: number): void; /** * Write a 64-bit float value to the end of the buffer. * @param {number} value - The 64-bit float value to write. */ writeFloat64(value: number): void; /** * Return the subarray of the buffer in the range [**start**,**end**]. * If **start** or **end** are < 0 then it is relative to the end of the buffer. * If **end** is not specified (or undefined), then it is the end of the buffer. * This is equivalent to the python list range operator. * @param {number} start - The start index of the subarray. * @param {number} [end] - The end index of the subarray. * @returns {Uint8Array} A Uint8Array representing the subarray. */ subarray(start: number, end?: number): Uint8Array; }