pub struct Image { /* private fields */ }Expand description
An widget to show an image of a given size.
ui.add(egui::Image::new(my_texture_id, [640.0, 480.0]));
// Shorter version:
ui.image(my_texture_id, [640.0, 480.0]);Se also crate::ImageButton.
Implementations§
Source§impl Image
impl Image
pub fn new(texture_id: TextureId, size: impl Into<Vec2>) -> Image
Sourcepub fn uv(self, uv: impl Into<Rect>) -> Image
pub fn uv(self, uv: impl Into<Rect>) -> Image
Select UV range. Default is (0,0) in top-left, (1,1) bottom right.
Sourcepub fn bg_fill(self, bg_fill: impl Into<Color32>) -> Image
pub fn bg_fill(self, bg_fill: impl Into<Color32>) -> Image
A solid color to put behind the image. Useful for transparent images.
Sourcepub fn tint(self, tint: impl Into<Color32>) -> Image
pub fn tint(self, tint: impl Into<Color32>) -> Image
Multiply image color with this. Default is WHITE (no tint).
Sourcepub fn sense(self, sense: Sense) -> Image
pub fn sense(self, sense: Sense) -> Image
Make the image respond to clicks and/or drags.
Consider using ImageButton instead, for an on-hover effect.
Trait Implementations§
impl Copy for Image
Auto Trait Implementations§
impl Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnwindSafe for Image
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more