UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

256 lines • 8.25 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; /** * * @type {Uint8Array[]} */ dataChunks: Uint8Array[]; /** * * @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 * @param {Uint8Array} chunk */ decodePLTE(chunk: Uint8Array): 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): Uint8Array; /** * De-interlace image according to Adam 7 scheme * @param {Uint8Array} data */ interlaceAdam7(data: Uint8Array): Uint8Array | Uint16Array; /** * * @param {number} filter_type * @param {Uint8Array} data * @param {number} scanline_address * @param {Uint8Array} output * @param {number} bytes_per_pixel * @param {number} output_offset * @param {number} output_offset_previous where does result of previous scanline begin in the output? Needed for various filters such as `Up` * @param {number} length * * @see https://www.w3.org/TR/PNG-Filters.html */ unFilter(filter_type: number, data: Uint8Array, scanline_address: number, output: Uint8Array, bytes_per_pixel: number, output_offset: number, output_offset_previous: number, length: number): void; /** * With the None filter, the scanline is transmitted unmodified; it is only necessary to insert a filter type byte before the data. * * @param {Uint8Array} data * @param {number} scanline_address * @param {Uint8Array} output * @param {number} bytes_per_pixel * @param {number} output_offset * @param {number} output_offset_previous * @param {number} length * * @see https://www.w3.org/TR/PNG-Filters.html */ unFilterNone(data: Uint8Array, scanline_address: number, output: Uint8Array, bytes_per_pixel: number, output_offset: number, output_offset_previous: number, length: number): void; /** * 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)` * * @param {Uint8Array} scanline raw data * @param {number} scanline_offset * @param {Uint8Array} pixels processed output * @param {number} bpp bytes-per-pixel * @param {number} offset * @param {number} output_offset_previous * @param {number} length * @see https://www.w3.org/TR/PNG-Filters.html */ unFilterSub(scanline: Uint8Array, scanline_offset: number, pixels: Uint8Array, bpp: number, offset: number, output_offset_previous: number, length: number): 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)` * * @param {Uint8Array} scanline raw data * @param {number} scanline_offset * @param {Uint8Array} pixels processed output * @param {number} bpp bytes-per-pixel * @param {number} offset * @param {number} output_offset_previous * @param {number} length * @see https://www.w3.org/TR/PNG-Filters.html */ unFilterUp(scanline: Uint8Array, scanline_offset: number, pixels: Uint8Array, bpp: number, offset: number, output_offset_previous: number, length: number): 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)` * * @param {Uint8Array} scanline raw data * @param {number} scanline_offset * @param {Uint8Array} pixels processed output * @param {number} bpp bytes-per-pixel * @param {number} offset * @param {number} output_offset_previous * @param {number} length * * @see https://www.w3.org/TR/PNG-Filters.html */ unFilterAverage(scanline: Uint8Array, scanline_offset: number, pixels: Uint8Array, bpp: number, offset: number, output_offset_previous: number, length: number): 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. * * @param {Uint8Array} scanline raw data * @param {number} scanline_offset * @param {Uint8Array} pixels processed output * @param {number} bpp bytes-per-pixel * @param {number} offset * @param {number} output_offset_previous * @param {number} length * * @see https://www.w3.org/TR/PNG-Filters.html */ unFilterPaeth(scanline: Uint8Array, scanline_offset: number, pixels: Uint8Array, bpp: number, offset: number, output_offset_previous: number, length: number): 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