Struct egui_fltk_frontend::RetainedEguiImage
source · [−]pub struct RetainedEguiImage {
pub debug_name: String,
pub size: [usize; 2],
pub image: Mutex<ColorImage>,
pub texture: Mutex<Option<TextureHandle>>,
}
Expand description
An image to be shown in egui.
Load once, and save somewhere in your app state.
Use the svg
and image
features to enable more constructors.
Fields
debug_name: String
size: [usize; 2]
image: Mutex<ColorImage>
Cleared once Self::texture
has been loaded.
texture: Mutex<Option<TextureHandle>>
Lazily loaded when we have an egui context.
Implementations
sourceimpl RetainedEguiImage
impl RetainedEguiImage
pub fn from_color_image(debug_name: impl Into<String>, image: ColorImage) -> Self
pub fn from_fltk_image<I: ImageExt>(
debug_name: impl Into<String>,
image: I
) -> Result<RetainedEguiImage, FltkError>
pub fn from_fltk_image_as_ref<I: ImageExt>(
debug_name: impl Into<String>,
image: &I
) -> Result<RetainedEguiImage, FltkError>
pub fn from_fltk_svg_image(
debug_name: impl Into<String>,
svg_image: SvgImage
) -> Result<RetainedEguiImage, FltkError>
sourcepub fn debug_name(&self) -> &str
pub fn debug_name(&self) -> &str
The debug name of the image, e.g. the file name.
sourcepub fn texture_id(&self, ctx: &Context) -> TextureId
pub fn texture_id(&self, ctx: &Context) -> TextureId
The texture id for this image.
sourcepub fn show_max_size(&self, ui: &mut Ui, max_size: Vec2) -> Response
pub fn show_max_size(&self, ui: &mut Ui, max_size: Vec2) -> Response
Show the image with the given maximum size.
sourcepub fn show(&self, ui: &mut Ui) -> Response
pub fn show(&self, ui: &mut Ui) -> Response
Show the image with the original size (one image pixel = one gui point).
sourcepub fn show_scaled(&self, ui: &mut Ui, scale: f32) -> Response
pub fn show_scaled(&self, ui: &mut Ui, scale: f32) -> Response
Show the image with the given scale factor (1.0 = original size).
Auto Trait Implementations
impl RefUnwindSafe for RetainedEguiImage
impl Send for RetainedEguiImage
impl Sync for RetainedEguiImage
impl Unpin for RetainedEguiImage
impl UnwindSafe for RetainedEguiImage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more