[][src]Trait iced::widget::image::Renderer

pub trait Renderer<I> {
    fn node(
        &self,
        style: Style,
        image: &I,
        width: Option<u16>,
        height: Option<u16>,
        source: Option<Rectangle<u16>>
    ) -> Node;
fn draw(
        &mut self,
        image: &I,
        bounds: Rectangle<f32>,
        source: Option<Rectangle<u16>>
    ); }

The renderer of an Image.

Your renderer will need to implement this trait before being able to use an Image in your user interface.

Required methods

fn node(
    &self,
    style: Style,
    image: &I,
    width: Option<u16>,
    height: Option<u16>,
    source: Option<Rectangle<u16>>
) -> Node

Creates a Node with the given Style for the provided Image and its size.

You should probably keep the original aspect ratio, if possible.

fn draw(
    &mut self,
    image: &I,
    bounds: Rectangle<f32>,
    source: Option<Rectangle<u16>>
)

Draws an Image.

It receives:

  • the bounds of the Image
  • the handle of the loaded Image
  • the portion of the image to draw. If not specified, the entire image should be drawn.
Loading content...

Implementors

Loading content...