Skip to main content

Crate otf_pixels_codec_png

Crate otf_pixels_codec_png 

Source
Expand description

PNG codec for otf-pixels, implemented from scratch.

Includes its own DEFLATE implementation per ADR-0010: PNG is mostly DEFLATE, so depending on a compression crate would reduce “PNG from scratch” to “PNG container parsing from scratch”.

Every parser here reads attacker-controlled bytes and returns errors rather than panicking. unsafe_code = "forbid" means the classic decompressor failure — an out-of-bounds write through a back-reference — is unrepresentable rather than merely avoided.

Structs§

Adler32
An incremental Adler-32, as specified for zlib streams.
Crc32
An incremental CRC-32, as specified for PNG chunks.
Header
A parsed IHDR chunk (§11.2.2).
Inflater
An incremental DEFLATE decompressor.
Level
Compression effort, 0 (stored) to 9 (most search).
PngCodec
The PNG entry in a sniffing registry.
PngDecoder
Decodes a PNG stream.
PngEncoder
Encodes a PNG stream.
ZlibStream
An incremental zlib (RFC 1950) decompressor.

Enums§

ColorType
A PNG colour type (§11.2.2).
Filter
A PNG scanline filter (§9.2).

Constants§

SIGNATURE
The eight-byte PNG signature (§5.2).

Functions§

deflate
Compress data into a raw DEFLATE stream.
inflate_to
Decompress a raw DEFLATE stream, refusing to exceed limit output bytes.
probe
Whether prefix starts with the PNG signature.
zlib_compress
Compress data into a zlib stream (RFC 1950).
zlib_decompress
Decompress a zlib stream (RFC 1950), verifying its Adler-32.