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)
44 lines • 1.12 kB
JavaScript
export class WebPFrame {
get x() {
return this._x;
}
get y() {
return this._y;
}
get width() {
return this._width;
}
get height() {
return this._height;
}
get duration() {
return this._duration;
}
get framePosition() {
return this._framePosition;
}
get frameSize() {
return this._frameSize;
}
get clearFrame() {
return this._clearFrame;
}
get isValid() {
return this._reserved === 0;
}
constructor(input, size) {
this._reserved = 1;
this._x = input.readUint24() * 2;
this._y = input.readUint24() * 2;
this._width = input.readUint24() + 1;
this._height = input.readUint24() + 1;
this._duration = input.readUint24();
const b = input.read();
this._reserved = (b & 0x7f) >>> 7;
this._clearFrame = (b & 0x1) !== 0;
this._framePosition = input.position;
this._frameSize = size - WebPFrame.animFrameHeaderSize;
}
}
WebPFrame.animFrameHeaderSize = 16;
//# sourceMappingURL=webp-frame.js.map