A no_std GIF library for embedded applications(embedded-graphics)

Overview

tinygif

A tiny gif decoder written in no_std Rust. This crate requires about 20kB of memory to decode a gif.

  • basic decoding
  • frame iterator
  • interlace support
  • fails on some highly compressed gifs: Change table size in DecodingDict

Usage

let image = tinygif::Gif::<Rgb565>::from_slice(include_bytes!("../small.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();
    }
}
You might also like...
Rust bindings for libtcod 1.6.3 (the Doryen library/roguelike toolkit)

Warning: Not Maintained This project is no longer actively developed or maintained. Please accept our apologies. Open pull requests may still get merg

A dependency-free chess engine library built to run anywhere.
A dependency-free chess engine library built to run anywhere.

♔chess-engine♚ A dependency-free chess engine library built to run anywhere. Demo | Docs | Contact Me Written in Rust 🦀 💖 Why write a Chess engine?

Scion is a tiny 2D game library built on top of wgpu, winit and legion.
Scion is a tiny 2D game library built on top of wgpu, winit and legion.

Scion is a 2D game library made in rust. Please note that this project is in its first milestones and is subject to change according to convience need

Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

Atomic Physics Library

Iridium Atomic Physics Library Attempt at making a atomic database. Uses Nubase2020, ENSDF for decay chains, atomic masses, and half-lives. Nubase2020

Minecraft Protocol Library

Protocol Minecraft Protocol Library This branch is dedicated to the Minecraft Bedrock Edition Protocol. If you have any concerns or questions you can

Synchronize games from other platforms into your Steam library

BoilR Description This little tool will synchronize games from other platforms into your Steam library, using the Steam Shortcuts feature. The goal is

A simple authoritative server networking library for Bevy.

Bevy Networking Plugin This is a simple networking plugin for the Bevy game engine. This plugin provides the building blocks which game developers can

3d transformation gizmo built on top of the egui library.
3d transformation gizmo built on top of the egui library.

egui-gizmo 3d transformation gizmo built on top of the egui library. Try it out in a web demo Usage let gizmo = Gizmo::new("My gizmo") .view_matri

Comments
  • Nyan Cat Demo

    Nyan Cat Demo

    https://github.com/andelf/tinygif/assets/72891/80841ed6-eff5-4f76-8265-9b09ba76ff9f

    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;
            }
        }
    }
    
    
    opened by andelf 0
Owner
Andelf
Andelf
Comparing performance of Rust math libraries for common 3D game and graphics tasks

mathbench mathbench is a suite of unit tests and benchmarks comparing the output and performance of a number of different Rust linear algebra librarie

Cameron Hart 137 Dec 8, 2022
🍖A WGPU graphics pipeline, along with simple types used to marshal data to the GPU

renderling ?? This library is a collection of WGPU render pipelines. Shaders are written in GLSL. shaderc is used to compile shaders to SPIR-V. Defini

Schell Carl Scivally 5 Dec 20, 2022
A chip-8 emulator in Rust, using raylib for graphics.

A chip-8 emulator in Rust, using raylib for graphics.

André Nogueira 2 Apr 16, 2022
Motion graphics creation tool in Bevy. (Highly inspired by Motion Canvas and Manim)

Bevy MotionGfx Bevy Motiongfx is a motion graphics creation tool in Bevy. It is highly inspired by Motion Canvas & Manim. Goal The goal of this tool i

Nixon 3 Nov 6, 2023
Game examples implemented in rust console applications primarily for educational purposes.

rust-console-games A collection of game examples implemented as rust console applications primarily for providing education and inspiration. :) Game *

Zachary Patten 2 Oct 11, 2022
A single-threaded polling-based Rust async executor suitable for use in games, embedded systems or WASM.

simple async local executor An Enlightware® software. Overview A single-threaded polling-based executor suitable for use in games, embedded systems or

Enlightware GmbH 16 Nov 15, 2022
Bevy plugin for an AssetServer that can load embedded resources, or use other AssetServers based on the path.

Bevy-Embasset Embed your asset folder inside your binary. bevy-embasset adds support for loading assets embedded into the binary. Furthermore, it can

Johnny Tidemand Vestergaard 9 Aug 4, 2022
A Rust wrapper and bindings of Allegro 5 game programming library

RustAllegro A thin Rust wrapper of Allegro 5. Game loop example extern crate allegro; extern crate allegro_font; use allegro::*; use allegro_font::*;

null 80 Dec 31, 2022
High performance Rust ECS library

Legion aims to be a feature rich high performance Entity component system (ECS) library for Rust game projects with minimal boilerplate. Getting Start

Amethyst Engine 1.4k Jan 5, 2023
Rust library to create a Good Game Easily

ggez What is this? ggez is a Rust library to create a Good Game Easily. The current version is 0.6.0-rc0. This is a RELEASE CANDIDATE version, which m

null 3.6k Jan 7, 2023