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)

58 lines 1.48 kB
import { GifColorMap } from './gif-color-map.js'; export class GifImageDesc { get x() { return this._x; } get y() { return this._y; } get width() { return this._width; } get height() { return this._height; } get interlaced() { return this._interlaced; } get colorMap() { return this._colorMap; } set colorMap(v) { this._colorMap = v; } set duration(v) { this._duration = v; } get duration() { return this._duration; } set disposal(v) { this._disposal = v; } get disposal() { return this._disposal; } get inputPosition() { return this._inputPosition; } constructor(input) { this._duration = 80; this._disposal = 0; this._x = input.readUint16(); this._y = input.readUint16(); this._width = input.readUint16(); this._height = input.readUint16(); const b = input.read(); const bitsPerPixel = (b & 0x07) + 1; this._interlaced = (b & 0x40) !== 0; if ((b & 0x80) !== 0) { this._colorMap = new GifColorMap(1 << bitsPerPixel); for (let i = 0; i < this._colorMap.numColors; ++i) { this._colorMap.setColor(i, input.read(), input.read(), input.read()); } } this._inputPosition = input.position; } } //# sourceMappingURL=gif-image-desc.js.map