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§
Source§impl 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 !Freeze for RetainedEguiImage
impl RefUnwindSafe for RetainedEguiImage
impl Send for RetainedEguiImage
impl Sync for RetainedEguiImage
impl Unpin for RetainedEguiImage
impl UnwindSafe for RetainedEguiImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more