irox_egui_extras/
lib.rs

1// SPDX-License-Identifier: MIT
2// Copyright 2025 IROX Contributors
3//
4
5//!
6//! Stuff that should have been in [`egui`], but isn't.
7//!
8
9#[macro_export]
10macro_rules! profile_scope {
11    ($name:expr) => {
12        #[cfg(feature = "profiling")]
13        profiling::scope!($name);
14    };
15    ($name:expr, $data:expr) => {
16        #[cfg(feature = "profiling")]
17        profiling::scope!($name, $data);
18    };
19}
20
21/// Historical frame rendering statistics
22pub mod frame_history;
23
24/// Utilities around [`egui::style`]
25#[cfg(feature = "serde")]
26pub mod styles;
27
28/// [`eframe::App`] composition tools
29pub mod composite;
30
31pub mod about;
32/// A customization of [`egui::widgets::ProgressBar`]
33pub mod progressbar;
34/// A popup progress widget
35pub mod progresswindow;
36
37pub mod fonts;
38#[cfg(feature = "plots")]
39pub mod logplot;
40pub mod repainting;
41#[cfg(feature = "serde")]
42pub mod serde;
43pub mod toolframe;
44pub mod visuals;
45
46pub trait WithAlpha {
47    #[must_use]
48    fn with_alpha(self, alpha: u8) -> Self;
49}
50impl WithAlpha for egui::Color32 {
51    #[must_use]
52    fn with_alpha(self, alpha: u8) -> Self {
53        let [r, g, b, _] = self.to_srgba_unmultiplied();
54        egui::Color32::from_rgba_unmultiplied(r, g, b, alpha)
55    }
56}