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)
16 lines • 481 B
JavaScript
export class VP8LColorCache {
constructor(hashBits) {
this._colors = new Uint32Array(1 << hashBits);
this._hashShift = 32 - hashBits;
}
insert(argb) {
const a = (argb * VP8LColorCache.hashMultiplier) & 0xffffffff;
const key = a >>> this._hashShift;
this._colors[key] = argb;
}
lookup(key) {
return this._colors[key];
}
}
VP8LColorCache.hashMultiplier = 0x1e35a7bd;
//# sourceMappingURL=vp8l-color-cache.js.map