4 个版本
0.0.4 | 2023年7月7日 |
---|---|
0.0.3 | 2023年6月25日 |
0.0.2 | 2023年6月7日 |
0.0.1 | 2023年6月7日 |
#383 在 图像
320KB
855 代码行
tinygif
使用 no_std
Rust 编写的微型 GIF 解码器。此 crate 需要 20kB 的内存来解码 GIF。
- 基本解码
- 帧迭代器
- 交错支持
- 在某些高度压缩的 GIF 上失败: 在 DecodingDict 中更改表大小
使用方法
let image = tinygif::Gif::<Rgb565>::from_slice(include_bytes!("../Ferris-240x240.gif")).unwrap();
loop {
for frame in image.frames() {
info!("frame {:?}", frame);
frame.draw(&mut display).unwrap();
let delay_ms = frame.delay_centis * 10;
info!("delay {}", delay_ms);
// Delay here
// Timer::after(Duration::from_millis(delay_ms as u64)).await;
// Or, draw at given offset
// use embedded_graphics::prelude::DrawTargetExt;
// frame.draw(&mut display.translated(Point::new(30, 50))).unwrap();
}
}
许可证
MIT 或 Apache-2.0 由您选择。
测试中使用的 GIF 文件的许可证
动画摩天轮在 Rust Fest Berlin 2016 上行动快乐,如 Rustacean(www.rustfest.eu)
- CC BY 4.0 为 Rust Fest Berlin 制作 Rustacean 动画摩天轮的 A. L. Palmer
- 由 ezgif 调整大小
依赖项
~4MB
~49K SLoC