iced/wgpu/src/renderer/widget/image.rs
Héctor Ramón Jiménez 505588d585 Allow to load an image from memory
New `image::Handle` opaque type uniquely identifying some `image::Data`,
allowing reliable caching.
2019-11-29 21:44:39 +01:00

22 lines
529 B
Rust

use crate::{Primitive, Renderer};
use iced_native::{image, Layout, MouseCursor};
impl image::Renderer for Renderer {
fn dimensions(&self, handle: &image::Handle) -> (u32, u32) {
self.image_pipeline.dimensions(handle)
}
fn draw(
&mut self,
handle: image::Handle,
layout: Layout<'_>,
) -> Self::Output {
(
Primitive::Image {
handle,
bounds: layout.bounds(),
},
MouseCursor::OutOfBounds,
)
}
}