Skip to main content

Crate svga

Crate svga 

Source
Expand description

A codec for the SVGA animation format: decode, inspect and losslessly edit. It renders nothing and makes no optimization decisions.

There are two layers:

  • Document is the lossless one. It keeps every top-level protobuf field as its original bytes, so unknown fields, field order and float bit patterns survive, and an unedited document re-encodes to the exact same payload. All edits happen here.
  • Movie is a typed, read-only view decoded on demand from a document.
let document = svga::Document::from_bytes(&file)?;
for image in document.images() {
    println!("{:?}: {} bytes", image.key(), image.value().len());
}
let smaller = document.replace_image("hat", b"hat.png")?;
let bytes = smaller.to_bytes(svga::Compression::Best)?;

Re-exports§

pub use movie::Movie;

Modules§

movie
The typed view: a read-only picture of a movie, decoded on demand.
wire
Minimal protobuf wire walker and writer.

Structs§

Animation
A decoded animation of any supported flavour.
Document
An SVGA 2.x movie that can be edited and re-encoded without loss.
Error
The error type of this crate.
ImageEntry
One entry of the images map as stored.
Limits
Upper bounds enforced while reading. Every reader has a _with variant taking these; the plain variants use Limits::default.

Enums§

Compression
Effort spent compressing the output.
Container
How a file wraps its movie, judged from the leading bytes only.
ErrorKind
What went wrong, at the level a caller usually branches on.
Format
How the movie is stored.
ValueKind
What an images value looks like. Sniffed from the bytes; nothing is decoded.

Functions§

is_animated_png
Whether a PNG declares animation. acTL must precede IDAT, so the walk stops at the first image data.
png_dimensions
Pixel width and height from a PNG’s header, without decoding anything. None when the bytes are not a PNG with a leading IHDR chunk.

Type Aliases§

Result