Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIF support #4620

Merged
merged 23 commits into from
Jun 19, 2024
Merged

GIF support #4620

merged 23 commits into from
Jun 19, 2024

Conversation

JustFrederik
Copy link
Contributor

@JustFrederik JustFrederik commented Jun 5, 2024

If you use egui_extras you need to add the gif feature flag to it. Then adding a .gif to egui is as easy as

ui.image(egui::include_image!("ferris.gif"));

@YgorSouza
Copy link
Contributor

Could add Closes #4489 to the description so we don't forget to close the issue afterward.

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking very promising! A a great test gif too :)

crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
@JustFrederik
Copy link
Contributor Author

@emilk every requested change is implemented. I didn't test the file_loader, but it should behave the exactly like the ehttp loader which works.

@JustFrederik JustFrederik requested a review from emilk June 6, 2024 16:32
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/ehttp_loader.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
@JustFrederik JustFrederik requested a review from emilk June 7, 2024 11:48
@JustFrederik
Copy link
Contributor Author

@emilk ??

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veery close now - just a few cleanups and we should be good to go

crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
@emilk
Copy link
Owner

emilk commented Jun 18, 2024

btw, as I mention in the PR template, opening a PR from your master branch is problematic. For one, it makes it much harder for me to test it.

@JustFrederik JustFrederik requested a review from emilk June 19, 2024 06:52
@JustFrederik
Copy link
Contributor Author

@emilk Im sorry. I will keep that in mind for the next pull request

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good!

I just need to test it before merging

EDIT: tested it, and it seems to work exactly as advertized!

crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui_extras/src/loaders/gif_loader.rs Outdated Show resolved Hide resolved
Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work - this is really cool!

crates/egui_extras/Cargo.toml Outdated Show resolved Hide resolved
examples/images/Cargo.toml Outdated Show resolved Hide resolved
@@ -27,6 +27,7 @@ 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"));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's super cool that this Just Works™️

@JustFrederik
Copy link
Contributor Author

should be ready to merge now

@emilk emilk merged commit 52a8e11 into emilk:master Jun 19, 2024
19 checks passed
@emilk
Copy link
Owner

emilk commented Jun 19, 2024

Thanks for going through all the review rounds on this!

@emilk emilk changed the title Gif support GIF support Jun 27, 2024
@emilk emilk added the feature New feature or request label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui_extras egui feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gif Support
3 participants