Skip to content

Commit 9a947e5

Browse files
committed
Final image API doc tweaks
1 parent cfbad1f commit 9a947e5

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

crates/eframe/src/native/run.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,11 @@ fn run_and_return(
160160
// Platform-dependent event handlers to workaround a winit bug
161161
// See: https://github.com/rust-windowing/winit/issues/987
162162
// See: https://github.com/rust-windowing/winit/issues/1619
163-
#[cfg(target_os = "windows")]
164-
winit::event::Event::RedrawEventsCleared => {
163+
winit::event::Event::RedrawEventsCleared if cfg!(target_os = "windows") => {
165164
next_repaint_time = extremely_far_future();
166165
winit_app.run_ui_and_paint()
167166
}
168-
#[cfg(not(target_os = "windows"))]
169-
winit::event::Event::RedrawRequested(_) => {
167+
winit::event::Event::RedrawRequested(_) if !cfg!(target_os = "windows") => {
170168
next_repaint_time = extremely_far_future();
171169
winit_app.run_ui_and_paint()
172170
}

crates/egui/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,8 @@ pub fn warn_if_debug_build(ui: &mut crate::Ui) {
448448
/// ui.image(egui::include_image!("../assets/ferris.png"));
449449
/// ui.add(
450450
/// egui::Image::new(egui::include_image!("../assets/ferris.png"))
451-
/// .rounding(egui::Rounding::same(6.0))
451+
/// .max_width(200.0)
452+
/// .rounding(10.0),
452453
/// );
453454
///
454455
/// let image_source: egui::ImageSource = egui::include_image!("../assets/ferris.png");

crates/egui/src/ui.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,8 @@ impl Ui {
15601560
/// ui.image(egui::include_image!("../assets/ferris.png"));
15611561
/// ui.add(
15621562
/// egui::Image::new(egui::include_image!("../assets/ferris.png"))
1563-
/// .rounding(egui::Rounding::same(6.0))
1563+
/// .max_width(200.0)
1564+
/// .rounding(10.0),
15641565
/// );
15651566
/// # });
15661567
/// ```

crates/egui_extras/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ http = ["dep:ehttp"]
4242
##
4343
## You also need to ALSO opt-in to the image formats you want to support, like so:
4444
## ```toml
45-
## image = { version = "0.24", features = ["jpeg", "png"] }
45+
## image = { version = "0.24", features = ["jpeg", "png"] } # Add the types you want support for
46+
4647
## ```
4748
image = ["dep:image"]
4849

crates/egui_extras/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ One thing `egui_extras` is commonly used for is to install image loaders for `eg
1313

1414
```toml
1515
egui_extras = { version = "*", features = ["all_loaders"] }
16-
image = { version = "0.24", features = ["jpeg", "png"] }
16+
image = { version = "0.24", features = ["jpeg", "png"] } # Add the types you want support for
1717
```
1818

1919
```rs

crates/egui_extras/src/loaders.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
///
2121
/// ```toml,ignore
2222
/// egui_extras = { version = "*", features = ["all_loaders"] }
23-
/// image = { version = "0.24", features = ["jpeg", "png"] }
23+
/// image = { version = "0.24", features = ["jpeg", "png"] } # Add the types you want support for
2424
/// ```
2525
///
2626
/// ⚠ You have to configure both the supported loaders in `egui_extras` _and_ the supported image formats

examples/images/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ impl eframe::App for MyApp {
2929
ui.image(egui::include_image!("ferris.svg"));
3030

3131
ui.add(
32-
egui::Image::new("https://picsum.photos/seed/1.759706314/1024")
33-
.rounding(egui::Rounding::same(10.0)),
32+
egui::Image::new("https://picsum.photos/seed/1.759706314/1024").rounding(10.0),
3433
);
3534
});
3635
});

0 commit comments

Comments
 (0)