UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

200 lines 5.75 kB
/** * * @param {ArrayBuffer} bytes * @constructor */ export function PNGReader(bytes: ArrayBuffer): void; export class PNGReader { /** * * @param {ArrayBuffer} bytes * @constructor */ constructor(bytes: ArrayBuffer); /** * current pointer * @type {number} */ i: number; /** * bytes buffer * @type {Uint8Array} */ bytes: Uint8Array; /** * Output object * @type {PNG} */ png: PNG; dataChunks: any[]; /** * * @type {BinaryBuffer} */ buffer: BinaryBuffer; /** * Whether CRC should be performed or not * @type {boolean} */ crc_enabled: boolean; /** * * @type {Uint8Array} */ header: Uint8Array; /** * * @param {number} length * @return {Uint8Array} */ readBytes(length: number): Uint8Array; /** * http://www.w3.org/TR/2003/REC-PNG-20031110/#5PNG-file-signature */ decodeHeader(): void; /** * http://www.w3.org/TR/2003/REC-PNG-20031110/#5Chunk-layout * * length = 4 bytes * type = 4 bytes (IHDR, PLTE, IDAT, IEND or others) * chunk = length bytes * crc = 4 bytes * * @returns {string} chunk type */ decodeChunk(): string; /** * https://www.w3.org/TR/2003/REC-PNG-20031110/#11sRGB * @param {Uint8Array} chunk */ decodesRGB(chunk: Uint8Array): void; /** * https://www.w3.org/TR/2003/REC-PNG-20031110/#11tIME * @param {Uint8Array} chunk */ decodetIME(chunk: Uint8Array): void; /** * International textual data * @see https://www.w3.org/TR/2003/REC-PNG-20031110/ * @param {Uint8Array} chunk */ decodeiTXt(chunk: Uint8Array): { keyword: string; language_tag: string; translated_keyword: string; text: string; }; /** * Compressed textual data * @see https://www.w3.org/TR/2003/REC-PNG-20031110/#11zTXt * @param {Uint8Array} chunk */ decodezTXt(chunk: Uint8Array): { keyword: string; text: string; }; /** * https://www.w3.org/TR/PNG/#11tEXt * @param {Uint8Array} chunk */ decodetEXt(chunk: Uint8Array): void; /** * NOTE: untested * https://www.w3.org/TR/PNG/#11iEXt * @param {Uint8Array} chunk */ decodeiEXt(chunk: Uint8Array): void; /** * http://www.w3.org/TR/2003/REC-PNG-20031110/#11IHDR * http://www.libpng.org/pub/png/spec/1.2/png-1.2-pdg.html#C.IHDR * * Width 4 bytes * Height 4 bytes * Bit depth 1 byte * Colour type 1 byte * Compression method 1 byte * Filter method 1 byte * Interlace method 1 byte */ decodeIHDR(chunk: any): void; /** * * http://www.w3.org/TR/PNG/#11PLTE */ decodePLTE(chunk: any): void; /** * http://www.w3.org/TR/2003/REC-PNG-20031110/#11IDAT */ decodeIDAT(chunk: any): void; /** * https://www.w3.org/TR/PNG/#11tRNS * @param {Uint8Array} chunk */ decodeTRNS(chunk: Uint8Array): void; /** * http://www.w3.org/TR/2003/REC-PNG-20031110/#11IEND */ decodeIEND(): void; /** * Uncompress IDAT chunks */ decodePixels(): void; /** * @param {Uint8Array} data */ interlaceNone(data: Uint8Array): void; /** * De-interlace image according to Adam 7 scheme * @param {Uint8Array} data */ interlaceAdam7(data: Uint8Array): never; /** * The Sub() filter transmits the difference between each byte and the value * of the corresponding byte of the prior pixel. * Sub(x) = Raw(x) + Raw(x - bpp) */ unFilterSub(scanline: any, scanline_offset: any, pixels: any, bpp: any, of: any, length: any): void; /** * The Up() filter is just like the Sub() filter except that the pixel * immediately above the current pixel, rather than just to its left, is used * as the predictor. * Up(x) = Raw(x) + Prior(x) */ unFilterUp(scanline: any, scanline_offset: any, pixels: any, bpp: any, of: any, length: any): void; /** * The Average() filter uses the average of the two neighboring pixels (left * and above) to predict the value of a pixel. * Average(x) = Raw(x) + floor((Raw(x-bpp)+Prior(x))/2) */ unFilterAverage(scanline: any, scanline_offset: any, pixels: any, bpp: any, of: any, length: any): void; /** * The Paeth() filter computes a simple linear function of the three * neighboring pixels (left, above, upper left), then chooses as predictor * the neighboring pixel closest to the computed value. This technique is due * to Alan W. Paeth. * Paeth(x) = Raw(x) + * PaethPredictor(Raw(x-bpp), Prior(x), Prior(x-bpp)) * function PaethPredictor (a, b, c) * begin * ; a = left, b = above, c = upper left * p := a + b - c ; initial estimate * pa := abs(p - a) ; distances to a, b, c * pb := abs(p - b) * pc := abs(p - c) * ; return nearest of a,b,c, * ; breaking ties in order a,b,c. * if pa <= pb AND pa <= pc then return a * else if pb <= pc then return b * else return c * end */ unFilterPaeth(scanline: any, scanline_offset: any, pixels: any, bpp: any, of: any, length: any): void; /** * Parse the PNG file * @returns {PNG} */ parse(): PNG; } import { PNG } from './PNG.js'; import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js"; //# sourceMappingURL=PNGReader.d.ts.map