pub struct Image<Handle = Handle> { /* private fields */ }
Available on crate feature
image
only.Expand description
A frame that displays an image while keeping aspect ratio.
§Example
use iced::widget::image;
enum Message {
// ...
}
fn view(state: &State) -> Element<'_, Message> {
image("ferris.png").into()
}

Implementations§
Source§impl<Handle> Image<Handle>
impl<Handle> Image<Handle>
Sourcepub fn height(self, height: impl Into<Length>) -> Self
pub fn height(self, height: impl Into<Length>) -> Self
Sets the height of the Image
boundaries.
Sourcepub fn content_fit(self, content_fit: ContentFit) -> Self
pub fn content_fit(self, content_fit: ContentFit) -> Self
Sets the [ContentFit
] of the Image
.
Defaults to [ContentFit::Contain
]
Sourcepub fn filter_method(self, filter_method: FilterMethod) -> Self
pub fn filter_method(self, filter_method: FilterMethod) -> Self
Sets the FilterMethod
of the Image
.
Sourcepub fn rotation(self, rotation: impl Into<Rotation>) -> Self
pub fn rotation(self, rotation: impl Into<Rotation>) -> Self
Applies the given [Rotation
] to the Image
.
Trait Implementations§
Source§impl<'a, Message, Theme, Renderer, Handle> From<Image<Handle>> for Element<'a, Message, Theme, Renderer>where
Renderer: Renderer<Handle = Handle>,
Handle: Clone + 'a,
impl<'a, Message, Theme, Renderer, Handle> From<Image<Handle>> for Element<'a, Message, Theme, Renderer>where
Renderer: Renderer<Handle = Handle>,
Handle: Clone + 'a,
Source§impl<Message, Theme, Renderer, Handle> Widget<Message, Theme, Renderer> for Image<Handle>where
Renderer: Renderer<Handle = Handle>,
Handle: Clone,
impl<Message, Theme, Renderer, Handle> Widget<Message, Theme, Renderer> for Image<Handle>where
Renderer: Renderer<Handle = Handle>,
Handle: Clone,
Source§fn draw(
&self,
_state: &Tree,
renderer: &mut Renderer,
_theme: &Theme,
_style: &Style,
layout: Layout<'_>,
_cursor: Cursor,
viewport: &Rectangle,
)
fn draw( &self, _state: &Tree, renderer: &mut Renderer, _theme: &Theme, _style: &Style, layout: Layout<'_>, _cursor: Cursor, viewport: &Rectangle, )
Draws the [
Widget
] using the associated Renderer
.§fn operate(
&self,
_state: &mut Tree,
_layout: Layout<'_>,
_renderer: &Renderer,
_operation: &mut dyn Operation,
)
fn operate( &self, _state: &mut Tree, _layout: Layout<'_>, _renderer: &Renderer, _operation: &mut dyn Operation, )
Applies an [
Operation
] to the [Widget
].§fn update(
&mut self,
_state: &mut Tree,
_event: &Event,
_layout: Layout<'_>,
_cursor: Cursor,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
_shell: &mut Shell<'_, Message>,
_viewport: &Rectangle,
)
fn update( &mut self, _state: &mut Tree, _event: &Event, _layout: Layout<'_>, _cursor: Cursor, _renderer: &Renderer, _clipboard: &mut dyn Clipboard, _shell: &mut Shell<'_, Message>, _viewport: &Rectangle, )
§fn mouse_interaction(
&self,
_state: &Tree,
_layout: Layout<'_>,
_cursor: Cursor,
_viewport: &Rectangle,
_renderer: &Renderer,
) -> Interaction
fn mouse_interaction( &self, _state: &Tree, _layout: Layout<'_>, _cursor: Cursor, _viewport: &Rectangle, _renderer: &Renderer, ) -> Interaction
Auto Trait Implementations§
impl<Handle> Freeze for Image<Handle>where
Handle: Freeze,
impl<Handle> RefUnwindSafe for Image<Handle>where
Handle: RefUnwindSafe,
impl<Handle> Send for Image<Handle>where
Handle: Send,
impl<Handle> Sync for Image<Handle>where
Handle: Sync,
impl<Handle> Unpin for Image<Handle>where
Handle: Unpin,
impl<Handle> UnwindSafe for Image<Handle>where
Handle: UnwindSafe,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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