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

Improve text redering and do all color operation in gamma space (#2071)

This commit is contained in:
Emil Ernerfeldt
2022-09-24 17:53:11 +02:00
committed by GitHub
parent 29fa63317e
commit 4ac1e28eae
36 changed files with 468 additions and 733 deletions

View File

@@ -18,6 +18,7 @@ fn main() {
struct MyApp {
image: RetainedImage,
tint: egui::Color32,
}
impl Default for MyApp {
@@ -28,6 +29,7 @@ impl Default for MyApp {
include_bytes!("rust-logo-256x256.png"),
)
.unwrap(),
tint: egui::Color32::from_rgb(255, 0, 255),
}
}
}
@@ -38,12 +40,22 @@ impl eframe::App for MyApp {
ui.heading("This is an image:");
self.image.show(ui);
ui.heading("This is a rotated image:");
ui.heading("This is a rotated image with a tint:");
ui.add(
egui::Image::new(self.image.texture_id(ctx), self.image.size_vec2())
.rotate(45.0_f32.to_radians(), egui::Vec2::splat(0.5)),
.rotate(45.0_f32.to_radians(), egui::Vec2::splat(0.5))
.tint(self.tint),
);
ui.horizontal(|ui| {
ui.label("Tint:");
egui::color_picker::color_edit_button_srgba(
ui,
&mut self.tint,
egui::color_picker::Alpha::BlendOrAdditive,
);
});
ui.heading("This is an image you can click:");
ui.add(egui::ImageButton::new(
self.image.texture_id(ctx),