Expand description
GIF codec for otf-pixels, implemented from scratch.
Decode covers the whole format: all frames, both interlace layouts, transparency, and every disposal method. Encode is single-frame with palette quantization, which is SPEC §Formats’ stated v1 scope — animation pipelines are v2.
§Frames and the engine
Decoder yields one image, so GifDecoder presents the first frame
composited onto the canvas. Every existing pipeline therefore works on a
GIF unchanged, and the engine stays frame-unaware.
Callers who want the animation use GifDecoder::next_frame, which walks
the remaining frames and applies disposal between them. That keeps
“animation pipelines are v2” honest: the decode is complete, and only the
graph integration is deferred.
Structs§
- Frame
- One decoded frame, with the animation metadata that came with it.
- GifCodec
- The GIF entry in a sniffing registry.
- GifDecoder
- Decodes a GIF stream.
- GifEncoder
- Encodes a single-frame GIF.
- Graphic
Control - State from a graphic control extension, applying to the next image.
- Image
Descriptor - An image descriptor: where a frame sits on the canvas and how it is coded.
- Palette
- A colour table of at most 256 entries.
- Screen
- The logical screen descriptor: the canvas every frame is drawn onto.
Enums§
- Disposal
- How the canvas is treated after a frame is displayed (§23.c.iv).
- Dither
- How colour error is handled when mapping pixels to a palette.
Functions§
- build_
palette - Build a palette of at most
sizeentries forpixels. - probe
- Whether
prefixstarts with a GIF signature. - quantize
- Map
pixelsontopalette, returning one index per pixel.