Final image API doc tweaks

This commit is contained in:
Emil Ernerfeldt 2023-09-27 16:40:26 +02:00
parent cfbad1f865
commit 9a947e5547
7 changed files with 11 additions and 11 deletions

View File

@ -160,13 +160,11 @@ fn run_and_return(
// Platform-dependent event handlers to workaround a winit bug // Platform-dependent event handlers to workaround a winit bug
// See: https://github.com/rust-windowing/winit/issues/987 // See: https://github.com/rust-windowing/winit/issues/987
// See: https://github.com/rust-windowing/winit/issues/1619 // See: https://github.com/rust-windowing/winit/issues/1619
#[cfg(target_os = "windows")] winit::event::Event::RedrawEventsCleared if cfg!(target_os = "windows") => {
winit::event::Event::RedrawEventsCleared => {
next_repaint_time = extremely_far_future(); next_repaint_time = extremely_far_future();
winit_app.run_ui_and_paint() winit_app.run_ui_and_paint()
} }
#[cfg(not(target_os = "windows"))] winit::event::Event::RedrawRequested(_) if !cfg!(target_os = "windows") => {
winit::event::Event::RedrawRequested(_) => {
next_repaint_time = extremely_far_future(); next_repaint_time = extremely_far_future();
winit_app.run_ui_and_paint() winit_app.run_ui_and_paint()
} }

View File

@ -448,7 +448,8 @@ pub fn warn_if_debug_build(ui: &mut crate::Ui) {
/// ui.image(egui::include_image!("../assets/ferris.png")); /// ui.image(egui::include_image!("../assets/ferris.png"));
/// ui.add( /// ui.add(
/// egui::Image::new(egui::include_image!("../assets/ferris.png")) /// egui::Image::new(egui::include_image!("../assets/ferris.png"))
/// .rounding(egui::Rounding::same(6.0)) /// .max_width(200.0)
/// .rounding(10.0),
/// ); /// );
/// ///
/// let image_source: egui::ImageSource = egui::include_image!("../assets/ferris.png"); /// let image_source: egui::ImageSource = egui::include_image!("../assets/ferris.png");

View File

@ -1560,7 +1560,8 @@ impl Ui {
/// ui.image(egui::include_image!("../assets/ferris.png")); /// ui.image(egui::include_image!("../assets/ferris.png"));
/// ui.add( /// ui.add(
/// egui::Image::new(egui::include_image!("../assets/ferris.png")) /// egui::Image::new(egui::include_image!("../assets/ferris.png"))
/// .rounding(egui::Rounding::same(6.0)) /// .max_width(200.0)
/// .rounding(10.0),
/// ); /// );
/// # }); /// # });
/// ``` /// ```

View File

@ -42,7 +42,8 @@ http = ["dep:ehttp"]
## ##
## You also need to ALSO opt-in to the image formats you want to support, like so: ## You also need to ALSO opt-in to the image formats you want to support, like so:
## ```toml ## ```toml
## image = { version = "0.24", features = ["jpeg", "png"] } ## image = { version = "0.24", features = ["jpeg", "png"] } # Add the types you want support for
## ``` ## ```
image = ["dep:image"] image = ["dep:image"]

View File

@ -13,7 +13,7 @@ One thing `egui_extras` is commonly used for is to install image loaders for `eg
```toml ```toml
egui_extras = { version = "*", features = ["all_loaders"] } egui_extras = { version = "*", features = ["all_loaders"] }
image = { version = "0.24", features = ["jpeg", "png"] } image = { version = "0.24", features = ["jpeg", "png"] } # Add the types you want support for
``` ```
```rs ```rs

View File

@ -20,7 +20,7 @@
/// ///
/// ```toml,ignore /// ```toml,ignore
/// egui_extras = { version = "*", features = ["all_loaders"] } /// egui_extras = { version = "*", features = ["all_loaders"] }
/// image = { version = "0.24", features = ["jpeg", "png"] } /// image = { version = "0.24", features = ["jpeg", "png"] } # Add the types you want support for
/// ``` /// ```
/// ///
/// ⚠ You have to configure both the supported loaders in `egui_extras` _and_ the supported image formats /// ⚠ You have to configure both the supported loaders in `egui_extras` _and_ the supported image formats

View File

@ -29,8 +29,7 @@ impl eframe::App for MyApp {
ui.image(egui::include_image!("ferris.svg")); ui.image(egui::include_image!("ferris.svg"));
ui.add( ui.add(
egui::Image::new("https://picsum.photos/seed/1.759706314/1024") egui::Image::new("https://picsum.photos/seed/1.759706314/1024").rounding(10.0),
.rounding(egui::Rounding::same(10.0)),
); );
}); });
}); });