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)

125 lines (124 loc) 3.76 kB
/** @format */ import { TypedArray } from '../../common/typings.js'; import { PvrColorRgb } from './pvr-color-rgb.js'; import { PvrColorRgba } from './pvr-color-rgba.js'; /** * Ported from Jeffrey Lim's PVRTC encoder/decoder, * https://bitbucket.org/jthlim/pvrtccompressor */ export declare class PvrPacket { /** 14-bit mask */ private static readonly bits14; /** 15-bit mask */ private static readonly bits15; /** Morton table for interleaving bits */ private static readonly mortonTable; /** Bilinear factors for interpolation */ static readonly bilinearFactors: number[][]; /** Weights for color and alpha blending */ static readonly weights: number[][]; /** Raw data of the packet */ private _rawData; get rawData(): Uint32Array; /** Index of the packet */ private _index; get index(): number; /** Modulation data of the packet */ get modulationData(): number; set modulationData(x: number); /** Color data of the packet */ get colorData(): number; set colorData(x: number); /** Flag indicating if punchthrough alpha is used */ private _usePunchthroughAlpha; get usePunchthroughAlpha(): boolean; set usePunchthroughAlpha(x: boolean); /** Color A of the packet */ private _colorA; get colorA(): number; set colorA(x: number); /** Flag indicating if color A is opaque */ private _colorAIsOpaque; get colorAIsOpaque(): boolean; set colorAIsOpaque(x: boolean); /** Color B of the packet */ private _colorB; get colorB(): number; set colorB(x: number); /** Flag indicating if color B is opaque */ private _colorBIsOpaque; get colorBIsOpaque(): boolean; set colorBIsOpaque(x: boolean); /** * Constructor for PvrPacket * @param {TypedArray} data - TypedArray containing the raw data */ constructor(data: TypedArray); /** * Get Morton number for given x and y coordinates * @param {number} x - X coordinate * @param {number} y - Y coordinate * @returns {number} Morton number */ private static getMortonNumber; /** * Get color data from the packet * @returns {number} Color data */ private getColorData; /** * Update the packet data */ private update; /** * Set the block coordinates * @param {number} x - X coordinate * @param {number} y - Y coordinate */ setBlock(x: number, y: number): void; /** * Set the index of the packet * @param {number} i - Index */ setIndex(i: number): void; /** * Set color A using PvrColorRgb * @param {PvrColorRgb} c - PvrColorRgb object */ setColorRgbA(c: PvrColorRgb): void; /** * Set color A using PvrColorRgba * @param {PvrColorRgba} c - PvrColorRgba object */ setColorRgbaA(c: PvrColorRgba): void; /** * Set color B using PvrColorRgb * @param {PvrColorRgb} c - PvrColorRgb object */ setColorRgbB(c: PvrColorRgb): void; /** * Set color B using PvrColorRgba * @param {PvrColorRgba} c - PvrColorRgba object */ setColorRgbaB(c: PvrColorRgba): void; /** * Get color A as PvrColorRgb * @returns {PvrColorRgb} PvrColorRgb object */ getColorRgbA(): PvrColorRgb; /** * Get color A as PvrColorRgba * @returns {PvrColorRgba} PvrColorRgba object */ getColorRgbaA(): PvrColorRgba; /** * Returns the RGB color representation of colorB. * @returns {PvrColorRgb} The RGB color. */ getColorRgbB(): PvrColorRgb; /** * Returns the RGBA color representation of colorB. * @returns {PvrColorRgba} The RGBA color. */ getColorRgbaB(): PvrColorRgba; }