1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Animated WebP support (#5470)

Adds support for animated WebP images. Used the already existing GIF
implementation as a template for most of it.

* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Aely
2024-12-29 12:46:08 +02:00
committed by GitHub
parent 01a7e31b13
commit 1e0f3a5e2d
10 changed files with 303 additions and 49 deletions

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:12eb9463cda6c2b1a160f085324f1afdfc5ced9ff0857df117030d8771259e5e
size 303453
oid sha256:a836741d52e1972b2047cefaabf59f601637d430d4b41bf6407ebda4f7931dac
size 273450

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

View File

@@ -6,7 +6,7 @@ use eframe::egui;
fn main() -> eframe::Result {
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([400.0, 800.0]),
viewport: egui::ViewportBuilder::default().with_inner_size([320.0, 880.0]),
..Default::default()
};
eframe::run_native(
@@ -27,11 +27,16 @@ impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
egui::ScrollArea::both().show(ui, |ui| {
ui.image(egui::include_image!("ferris.gif"));
ui.add(
egui::Image::new("https://picsum.photos/seed/1.759706314/1024").rounding(10.0),
);
ui.image(egui::include_image!("ferris.svg"));
ui.image(egui::include_image!("cat.webp"))
.on_hover_text_at_pointer("WebP");
ui.image(egui::include_image!("ferris.gif"))
.on_hover_text_at_pointer("Gif");
ui.image(egui::include_image!("ferris.svg"))
.on_hover_text_at_pointer("Svg");
let url = "https://picsum.photos/seed/1.759706314/1024";
ui.add(egui::Image::new(url).rounding(10.0))
.on_hover_text_at_pointer(url);
});
});
}