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)

62 lines (61 loc) 2.44 kB
/** @format */ import { MemoryImage } from '../image/image.js'; import { Encoder, EncoderEncodeOptions } from './encoder.js'; import { PvrFormat } from './pvr/pvr-format.js'; /** * Ported from Jeffrey Lim's PVRTC encoder/decoder, * https://bitbucket.org/jthlim/pvrtccompressor */ export declare class PvrEncoder implements Encoder { /** The format of the PVR encoder */ private readonly _format; /** Indicates if the encoder supports animation */ private _supportsAnimation; /** * Gets the value indicating if the encoder supports animation * @returns {boolean} True if supports animation, otherwise false */ get supportsAnimation(): boolean; /** * Constructs a new PvrEncoder * @param {PvrFormat} format - The format of the PVR encoder */ constructor(format?: PvrFormat); /** * Calculates the bounding box for RGB color * @param {MemoryImage} bitmap - The image bitmap * @param {number} blockX - The X coordinate of the block * @param {number} blockY - The Y coordinate of the block * @returns {PvrColorBoundingBox} The calculated bounding box */ private static calculateBoundingBoxRgb; /** * Calculates the bounding box for RGBA color * @param {MemoryImage} bitmap - The image bitmap * @param {number} blockX - The X coordinate of the block * @param {number} blockY - The Y coordinate of the block * @returns {PvrColorBoundingBox} The calculated bounding box */ private static calculateBoundingBoxRgba; /** * Encodes the image using the specified options * @param {EncoderEncodeOptions} opt - The encoding options * @param {MemoryImage} opt.image - The image to encode * @returns {Uint8Array} The encoded image data */ encode(opt: EncoderEncodeOptions): Uint8Array; /** * Encodes the image in RGB 4bpp format * @param {MemoryImage} bitmap - The image bitmap * @returns {Uint8Array} The encoded image data * @throws {LibError} If the image is not square or not power-of-two sized */ encodeRgb4bpp(bitmap: MemoryImage): Uint8Array; /** * Encodes the image in RGBA 4bpp format * @param {MemoryImage} bitmap - The image bitmap * @returns {Uint8Array} The encoded image data * @throws {LibError} If the image is not square or not power-of-two sized */ encodeRgba4bpp(bitmap: MemoryImage): Uint8Array; }