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)
31 lines (30 loc) • 1.03 kB
TypeScript
/** @format */
/**
* Bit writer that packs bits LSB-first into bytes.
*
* This class allows writing individual bits or groups of bits into a byte array,
* packing them in a least-significant-bit-first order. Useful for encoding
* bitstreams in formats such as WebP.
*/
export declare class WebPBitWriter {
private readonly _bytes;
private _currentByte;
private _usedBits;
/**
* Writes a value as a sequence of bits to the bitstream.
* Bits are written LSB-first.
* @param {number} value - The value to write.
* @param {number} numBits - The number of bits to write from the value.
*/
writeBits(value: number, numBits: number): void;
/**
* Flushes any remaining bits in the current byte to the byte array.
* If the current byte is partially filled, it is padded with zeros.
*/
flush(): void;
/**
* Returns the written bytes as a Uint8Array.
* @returns {Uint8Array} The byte array containing the written bits.
*/
getBytes(): Uint8Array;
}