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
IHDRchunk (§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.
- Zlib
Stream - An incremental zlib (RFC 1950) decompressor.
Enums§
Constants§
- SIGNATURE
- The eight-byte PNG signature (§5.2).
Functions§
- deflate
- Compress
datainto a raw DEFLATE stream. - inflate_
to - Decompress a raw DEFLATE stream, refusing to exceed
limitoutput bytes. - probe
- Whether
prefixstarts with the PNG signature. - zlib_
compress - Compress
datainto a zlib stream (RFC 1950). - zlib_
decompress - Decompress a zlib stream (RFC 1950), verifying its Adler-32.