diff options
author | 2024-08-04 14:52:29 +0200 | |
---|---|---|
committer | 2024-08-04 14:52:29 +0200 | |
commit | 145c3dc8fc4f92c400fbc3f8202ed22e1d498663 (patch) | |
tree | fe48b8e7f0021100aa2a0c697437527212af3475 /widget/src/image.rs | |
parent | 9cccaebb04944f2295cadff716d9708f4caa5642 (diff) | |
parent | cc076903dda18f79dbd82238f7a8216bab8c679d (diff) | |
download | iced-145c3dc8fc4f92c400fbc3f8202ed22e1d498663.tar.gz iced-145c3dc8fc4f92c400fbc3f8202ed22e1d498663.tar.bz2 iced-145c3dc8fc4f92c400fbc3f8202ed22e1d498663.zip |
Merge pull request #2537 from iced-rs/feature/canvas-image-support
`image` and `svg` support for `canvas`
Diffstat (limited to 'widget/src/image.rs')
-rw-r--r-- | widget/src/image.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/widget/src/image.rs b/widget/src/image.rs index 80e17263..e04f2d6f 100644 --- a/widget/src/image.rs +++ b/widget/src/image.rs @@ -43,7 +43,7 @@ pub struct Image<Handle> { impl<Handle> Image<Handle> { /// Creates a new [`Image`] with the given path. - pub fn new<T: Into<Handle>>(handle: T) -> Self { + pub fn new(handle: impl Into<Handle>) -> Self { Image { handle: handle.into(), width: Length::Shrink, @@ -181,11 +181,14 @@ pub fn draw<Renderer, Handle>( let render = |renderer: &mut Renderer| { renderer.draw_image( - handle.clone(), - filter_method, + image::Image { + handle: handle.clone(), + filter_method, + rotation: rotation.radians(), + opacity, + snap: true, + }, drawing_bounds, - rotation.radians(), - opacity, ); }; |