mirror of
https://github.com/emilk/egui.git
synced 2026-06-28 07:23:13 -04:00
Final polish for new image loading (#3328)
* add egui logo to widget gallery * improve "no image loaders" error message * rework static URIs to accept `Cow<'static>` * remove `RetainedImage` from `http_app` in `egui_demo_app` * hide `RetainedImage` from docs * use `ui.image`/`Image` over `RawImage` * remove last remanant of `RawImage` * remove unused doc link * add style option to disable image spinners * use `Into<Image>` instead of `Into<ImageSource>` to allow configuring the underlying image * propagate `image_options` through `ImageButton` * calculate image size properly in `Button` * properly calculate size in `ImageButton` * Update crates/egui/src/widgets/image.rs Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com> * improve no image loaders error message * add `size()` helper to `TexturePoll` * try get size from poll in `Button` * add `paint_at` to `Spinner` * use `Spinner::paint_at` and hover on image button response * `show_spinner` -> `show_loading_spinner` * avoid `allocate_ui` in `Image` when painting spinner * make icon smaller + remove old texture * add `load_and_calculate_size` + expose `paint_image_at` * update `egui_plot` to paint image in the right place * Add helpers for painting an ImageSource directly * Use max_size=INF as default * Use new API in WidgetGallery * Make egui_demo_app work by default * Remove Option from scale * Refactor ImageSize * Fix docstring * Small refactor --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -1234,12 +1234,19 @@ impl PlotItem for PlotImage {
|
||||
Rect::from_two_pos(left_top_screen, right_bottom_screen)
|
||||
};
|
||||
let screen_rotation = -*rotation as f32;
|
||||
RawImage::new((*texture_id, image_screen_rect.size()))
|
||||
.bg_fill(*bg_fill)
|
||||
.tint(*tint)
|
||||
.uv(*uv)
|
||||
.rotate(screen_rotation, Vec2::splat(0.5))
|
||||
.paint_at(ui, image_screen_rect);
|
||||
|
||||
egui::paint_image_at(
|
||||
ui,
|
||||
image_screen_rect,
|
||||
&ImageOptions {
|
||||
uv: *uv,
|
||||
bg_fill: *bg_fill,
|
||||
tint: *tint,
|
||||
rotation: Some((Rot2::from_angle(screen_rotation), Vec2::splat(0.5))),
|
||||
rounding: Rounding::ZERO,
|
||||
},
|
||||
&(*texture_id, image_screen_rect.size()).into(),
|
||||
);
|
||||
if *highlight {
|
||||
let center = image_screen_rect.center();
|
||||
let rotation = Rot2::from_angle(screen_rotation);
|
||||
|
||||
Reference in New Issue
Block a user