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)

26 lines 836 B
import { ArrayUtils } from '../../common/array-utils.js'; import { HuffmanCode } from './webp-huffman-code.js'; export class HuffmanCodeList { get length() { return this._htree.length - this._offset; } constructor(htree, offset = 0) { this._htree = htree; this._offset = offset; } static sized(size) { return new HuffmanCodeList(ArrayUtils.generate(size, () => new HuffmanCode()), 0); } static from(other, offset) { return new HuffmanCodeList(other._htree, other._offset + offset); } get(index) { return this._htree[this._offset + index]; } set(index, code) { const target = this._htree[this._offset + index]; target.bits = code.bits; target.value = code.value; } } //# sourceMappingURL=webp-huffman-code-list.js.map