Repository navigation
svga v0.1.1
Additive release: nothing existing changes shape. These came out of moving the first consumer's optimizer and renderer onto the crate.
Added
Document::replace_image_atandDocument::remove_image_ataddress an entry by its position inimages(). They reach what the&str-keyed edits cannot name: repeated keys, and keys that are not valid UTF-8. Out of range isInvalidEdit("svga_image_index_out_of_range").Animation::into_moviehands over the typed movie and releases the file's images and buffers. Fetch the images you need throughAnimation::imagefirst.Animation::image_kind(key)sniffs the bytesAnimation::imageresolves, so it also works for SVGA 1.x and zipped files.svga::png_dimensions(bytes)reads width and height from a PNG header. No pixels are decoded.ValueKind::Jpegfor values starting with a JPEG start-of-image marker.
Behaviour note
A JPEG image value used to sniff as ValueKind::Unknown and now sniffs as ValueKind::Jpeg. Code that treats "not a PNG" as Unknown should test != ValueKind::Png instead. The enum is #[non_exhaustive], so this compiles unchanged.
Documentation
Document::from_byteswalks the whole payload up front, so a malformed file is reported as malformed even if it also contains things a caller would refuse on policy grounds.ValueKindis an ordered heuristic: short text starting withID3reads asMp3, and an empty value isUnknown.