summaryrefslogtreecommitdiffstats
path: root/tiny_skia/src/engine.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-08-04 14:52:29 +0200
committerLibravatar GitHub <noreply@github.com>2024-08-04 14:52:29 +0200
commit145c3dc8fc4f92c400fbc3f8202ed22e1d498663 (patch)
treefe48b8e7f0021100aa2a0c697437527212af3475 /tiny_skia/src/engine.rs
parent9cccaebb04944f2295cadff716d9708f4caa5642 (diff)
parentcc076903dda18f79dbd82238f7a8216bab8c679d (diff)
downloadiced-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 'tiny_skia/src/engine.rs')
-rw-r--r--tiny_skia/src/engine.rs32
1 files changed, 10 insertions, 22 deletions
diff --git a/tiny_skia/src/engine.rs b/tiny_skia/src/engine.rs
index 898657c8..196c36cf 100644
--- a/tiny_skia/src/engine.rs
+++ b/tiny_skia/src/engine.rs
@@ -550,13 +550,7 @@ impl Engine {
) {
match image {
#[cfg(feature = "image")]
- Image::Raster {
- handle,
- filter_method,
- bounds,
- rotation,
- opacity,
- } => {
+ Image::Raster(raster, bounds) => {
let physical_bounds = *bounds * _transformation;
if !_clip_bounds.intersects(&physical_bounds) {
@@ -567,7 +561,7 @@ impl Engine {
.then_some(_clip_mask as &_);
let center = physical_bounds.center();
- let radians = f32::from(*rotation);
+ let radians = f32::from(raster.rotation);
let transform = into_transform(_transformation).post_rotate_at(
radians.to_degrees(),
@@ -576,23 +570,17 @@ impl Engine {
);
self.raster_pipeline.draw(
- handle,
- *filter_method,
+ &raster.handle,
+ raster.filter_method,
*bounds,
- *opacity,
+ raster.opacity,
_pixels,
transform,
clip_mask,
);
}
#[cfg(feature = "svg")]
- Image::Vector {
- handle,
- color,
- bounds,
- rotation,
- opacity,
- } => {
+ Image::Vector(svg, bounds) => {
let physical_bounds = *bounds * _transformation;
if !_clip_bounds.intersects(&physical_bounds) {
@@ -603,7 +591,7 @@ impl Engine {
.then_some(_clip_mask as &_);
let center = physical_bounds.center();
- let radians = f32::from(*rotation);
+ let radians = f32::from(svg.rotation);
let transform = into_transform(_transformation).post_rotate_at(
radians.to_degrees(),
@@ -612,10 +600,10 @@ impl Engine {
);
self.vector_pipeline.draw(
- handle,
- *color,
+ &svg.handle,
+ svg.color,
physical_bounds,
- *opacity,
+ svg.opacity,
_pixels,
transform,
clip_mask,