Struct 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§

Source§

impl RetainedEguiImage

Source

pub fn from_color_image( debug_name: impl Into<String>, image: ColorImage, ) -> Self

Source

pub fn from_fltk_image<I: ImageExt>( debug_name: impl Into<String>, image: I, ) -> Result<RetainedEguiImage, FltkError>

Source

pub fn from_fltk_image_as_ref<I: ImageExt>( debug_name: impl Into<String>, image: &I, ) -> Result<RetainedEguiImage, FltkError>

Source

pub fn from_fltk_svg_image( debug_name: impl Into<String>, svg_image: SvgImage, ) -> Result<RetainedEguiImage, FltkError>

Source

pub fn size(&self) -> [usize; 2]

The size of the image data (number of pixels wide/high).

Source

pub fn size_vec2(&self) -> Vec2

The size of the image data (number of pixels wide/high).

Source

pub fn debug_name(&self) -> &str

The debug name of the image, e.g. the file name.

Source

pub fn texture_id(&self, ctx: &Context) -> TextureId

The texture id for this image.

Source

pub fn show_max_size(&self, ui: &mut Ui, max_size: Vec2) -> Response

Show the image with the given maximum size.

Source

pub fn show(&self, ui: &mut Ui) -> Response

Show the image with the original size (one image pixel = one gui point).

Source

pub fn show_scaled(&self, ui: &mut Ui, scale: f32) -> Response

Show the image with the given scale factor (1.0 = original size).

Source

pub fn show_size(&self, ui: &mut Ui, desired_size: Vec2) -> Response

Show the image with the given size.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>