andelf / tinygif Goto Github PK
View Code? Open in Web Editor NEWA no_std GIF library for embedded applications(embedded-graphics)
License: Apache License 2.0
A no_std GIF library for embedded applications(embedded-graphics)
License: Apache License 2.0
Hi,
I'll probably take a look at this myself, creating an issue first incase you can point out it's impossible or any pitfalls.
What I'm after is a from_iter
, similar to from_slice
but it'd get given an iter which returns u8
s instead of a u8 array.
(I'm reading GIF files off of an SD card & the GIFs can be too large for a full one to fit in memory).
It'd pull the headers etc from the input iter, store them same as what happens with the from_slice
.
I think it it'd need to return frames
as an iterator over frame
& would only be able to do 1 loop (since the input iter will get consumed), but other than that I'm not seeing any major issues
let image = tinygif::Gif::<Rgb565>::from_slice(include_bytes!("../../cat.gif")).unwrap();
loop {
for frame in image.frames() {
let start = Instant::now();
frame.draw(&mut display.translated(Point::new(10, 80))).unwrap();
let elapsed = start.elapsed().as_millis();
info!("draw {}ms", elapsed);
let delay_ms = (frame.delay_centis * 10) as u64;
info!("delay {}", delay_ms);
if delay_ms > elapsed {
Timer::after(Duration::from_millis((delay_ms - elapsed) as u64)).await;
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.