irox_egui_extras/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-License-Identifier: MIT
// Copyright 2023 IROX Contributors

//!
//! Stuff that should have been in [`egui`], but isn't.
//!

#[macro_export]
macro_rules! profile_scope {
    ($name:expr) => {
        #[cfg(feature = "profiling")]
        profiling::scope!($name);
    };
    ($name:expr, $data:expr) => {
        #[cfg(feature = "profiling")]
        profiling::scope!($name, $data);
    };
}

/// Historical frame rendering statistics
pub mod frame_history;

/// Utilities around [`egui::style`]
#[cfg(feature = "serde")]
pub mod styles;

/// [`eframe::App`] composition tools
pub mod composite;

pub mod about;
/// A customization of [`egui::widgets::ProgressBar`]
pub mod progressbar;

pub mod fonts;
#[cfg(feature = "plots")]
pub mod logplot;
pub mod repainting;
#[cfg(feature = "serde")]
pub mod serde;
pub mod toolframe;
pub mod visuals;

pub mod build {
    include!(concat!(env!("OUT_DIR"), "/builders.rs"));
}

pub trait WithAlpha {
    #[must_use]
    fn with_alpha(self, alpha: u8) -> Self;
}
impl WithAlpha for egui::Color32 {
    #[must_use]
    fn with_alpha(self, alpha: u8) -> Self {
        let [r, g, b, _] = self.to_srgba_unmultiplied();
        egui::Color32::from_rgba_unmultiplied(r, g, b, alpha)
    }
}