From b5b78d505e22cafccb4ecbf57dc61f536ca558ca Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 30 Apr 2024 07:57:54 +0200 Subject: Introduce `canvas::Cache` grouping Caches with the same `Group` will share their text atlas! --- tiny_skia/src/geometry.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tiny_skia') diff --git a/tiny_skia/src/geometry.rs b/tiny_skia/src/geometry.rs index 117daf41..02b6e1b9 100644 --- a/tiny_skia/src/geometry.rs +++ b/tiny_skia/src/geometry.rs @@ -1,9 +1,10 @@ use crate::core::text::LineHeight; use crate::core::{Pixels, Point, Radians, Rectangle, Size, Vector}; +use crate::graphics::cache::{self, Cached}; use crate::graphics::geometry::fill::{self, Fill}; use crate::graphics::geometry::stroke::{self, Stroke}; use crate::graphics::geometry::{self, Path, Style}; -use crate::graphics::{Cached, Gradient, Text}; +use crate::graphics::{Gradient, Text}; use crate::Primitive; use std::rc::Rc; @@ -32,7 +33,7 @@ impl Cached for Geometry { Self::Cache(cache.clone()) } - fn cache(self, _previous: Option) -> Cache { + fn cache(self, _group: cache::Group, _previous: Option) -> Cache { match self { Self::Live { primitives, -- cgit From 45254ab88c6ca76759523069c2fb8734de626f02 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 May 2024 00:55:49 +0200 Subject: Use `Bytes` as the `Container` of `ImageBuffer` Since we don't need to mutate images once loaded, we avoid unnecessary extra allocations. --- tiny_skia/src/raster.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tiny_skia') diff --git a/tiny_skia/src/raster.rs b/tiny_skia/src/raster.rs index 176b0da9..59f1e4d5 100644 --- a/tiny_skia/src/raster.rs +++ b/tiny_skia/src/raster.rs @@ -83,7 +83,7 @@ impl Cache { let id = handle.id(); if let hash_map::Entry::Vacant(entry) = self.entries.entry(id) { - let image = graphics::image::load(handle).ok()?.into_rgba8(); + let image = graphics::image::load(handle).ok()?; let mut buffer = vec![0u32; image.width() as usize * image.height() as usize]; -- cgit From b52c7bb610f593fffc624d461dca17ac50c81626 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 May 2024 01:39:43 +0200 Subject: Use an opaque `Id` type for `image::Handle` Hashing pointers is a terrible idea. --- tiny_skia/src/raster.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tiny_skia') diff --git a/tiny_skia/src/raster.rs b/tiny_skia/src/raster.rs index 59f1e4d5..907fce7c 100644 --- a/tiny_skia/src/raster.rs +++ b/tiny_skia/src/raster.rs @@ -71,8 +71,8 @@ impl Pipeline { #[derive(Debug, Default)] struct Cache { - entries: FxHashMap>, - hits: FxHashSet, + entries: FxHashMap>, + hits: FxHashSet, } impl Cache { -- cgit From 09a6bcfffc24f5abdc8709403bab7ae1e01563f1 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 May 2024 13:15:17 +0200 Subject: Add `Image` rotation support Co-authored-by: DKolter <68352124+DKolter@users.noreply.github.com> --- tiny_skia/src/engine.rs | 49 ++++++++++++++++++++++++++++++++++--------------- tiny_skia/src/layer.rs | 32 ++++++++++++++++++++++++++++---- tiny_skia/src/lib.rs | 17 ++++++++++++++--- tiny_skia/src/vector.rs | 4 +++- 4 files changed, 79 insertions(+), 23 deletions(-) (limited to 'tiny_skia') diff --git a/tiny_skia/src/engine.rs b/tiny_skia/src/engine.rs index fbca1274..564d3752 100644 --- a/tiny_skia/src/engine.rs +++ b/tiny_skia/src/engine.rs @@ -539,10 +539,10 @@ impl Engine { pub fn draw_image( &mut self, image: &Image, - _transformation: Transformation, - _pixels: &mut tiny_skia::PixmapMut<'_>, - _clip_mask: &mut tiny_skia::Mask, - _clip_bounds: Rectangle, + transformation: Transformation, + pixels: &mut tiny_skia::PixmapMut<'_>, + clip_mask: &mut tiny_skia::Mask, + clip_bounds: Rectangle, ) { match image { #[cfg(feature = "image")] @@ -550,22 +550,31 @@ impl Engine { handle, filter_method, bounds, + rotation, + scale, } => { - let physical_bounds = *bounds * _transformation; + let physical_bounds = *bounds * transformation; - if !_clip_bounds.intersects(&physical_bounds) { + if !clip_bounds.intersects(&physical_bounds) { return; } - let clip_mask = (!physical_bounds.is_within(&_clip_bounds)) - .then_some(_clip_mask as &_); + let clip_mask = (!physical_bounds.is_within(&clip_bounds)) + .then_some(clip_mask as &_); + + let center = physical_bounds.center(); + let transform = into_transform(transformation) + .post_rotate_at(rotation.to_degrees(), center.x, center.y) + .post_translate(-center.x, -center.y) + .post_scale(scale.width, scale.height) + .post_translate(center.x, center.y); self.raster_pipeline.draw( handle, *filter_method, *bounds, - _pixels, - into_transform(_transformation), + pixels, + transform, clip_mask, ); } @@ -574,21 +583,31 @@ impl Engine { handle, color, bounds, + rotation, + scale, } => { - let physical_bounds = *bounds * _transformation; + let physical_bounds = *bounds * transformation; - if !_clip_bounds.intersects(&physical_bounds) { + if !clip_bounds.intersects(&physical_bounds) { return; } - let clip_mask = (!physical_bounds.is_within(&_clip_bounds)) - .then_some(_clip_mask as &_); + let clip_mask = (!physical_bounds.is_within(&clip_bounds)) + .then_some(clip_mask as &_); + + let center = physical_bounds.center(); + let transform = into_transform(transformation) + .post_rotate_at(rotation.to_degrees(), center.x, center.y) + .post_translate(-center.x, -center.y) + .post_scale(scale.width, scale.height) + .post_translate(center.x, center.y); self.vector_pipeline.draw( handle, *color, physical_bounds, - _pixels, + pixels, + transform, clip_mask, ); } diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs index 3e42e4aa..e9651814 100644 --- a/tiny_skia/src/layer.rs +++ b/tiny_skia/src/layer.rs @@ -1,7 +1,7 @@ -use crate::core::image; -use crate::core::renderer::Quad; -use crate::core::svg; -use crate::core::{Background, Color, Point, Rectangle, Transformation}; +use crate::core::{ + image, renderer::Quad, svg, Background, Color, Point, Rectangle, Size, + Transformation, +}; use crate::graphics::damage; use crate::graphics::layer; use crate::graphics::text::{Editor, Paragraph, Text}; @@ -121,11 +121,15 @@ impl Layer { filter_method: image::FilterMethod, bounds: Rectangle, transformation: Transformation, + rotation: f32, + scale: Size, ) { let image = Image::Raster { handle, filter_method, bounds: bounds * transformation, + rotation, + scale, }; self.images.push(image); @@ -137,11 +141,15 @@ impl Layer { color: Option, bounds: Rectangle, transformation: Transformation, + rotation: f32, + scale: Size, ) { let svg = Image::Vector { handle, color, bounds: bounds * transformation, + rotation, + scale, }; self.images.push(svg); @@ -256,6 +264,22 @@ impl Layer { Image::eq, ); + // let center = bounds.center(); + // let rotated_size = RotationLayout::Change + // .apply_to_size(bounds.size(), *rotation); + // + // let scaled_size = Size::new( + // rotated_size.width * scale.width, + // rotated_size.height * scale.height, + // ); + // + // let top_left = Point::new( + // center.x - scaled_size.width / 2.0, + // center.y - scaled_size.height / 2.0, + // ); + // + // Rectangle::new(top_left, scaled_size).expand(1.0) + damage.extend(text); damage.extend(primitives); damage.extend(images); diff --git a/tiny_skia/src/lib.rs b/tiny_skia/src/lib.rs index 4c2c9430..4e3ebad3 100644 --- a/tiny_skia/src/lib.rs +++ b/tiny_skia/src/lib.rs @@ -29,7 +29,7 @@ pub use geometry::Geometry; use crate::core::renderer; use crate::core::{ - Background, Color, Font, Pixels, Point, Rectangle, Transformation, + Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation, }; use crate::engine::Engine; use crate::graphics::compositor; @@ -377,9 +377,18 @@ impl core::image::Renderer for Renderer { handle: Self::Handle, filter_method: core::image::FilterMethod, bounds: Rectangle, + rotation: f32, + scale: Size, ) { let (layer, transformation) = self.layers.current_mut(); - layer.draw_image(handle, filter_method, bounds, transformation); + layer.draw_image( + handle, + filter_method, + bounds, + transformation, + rotation, + scale, + ); } } @@ -397,9 +406,11 @@ impl core::svg::Renderer for Renderer { handle: core::svg::Handle, color: Option, bounds: Rectangle, + rotation: f32, + scale: Size, ) { let (layer, transformation) = self.layers.current_mut(); - layer.draw_svg(handle, color, bounds, transformation); + layer.draw_svg(handle, color, bounds, transformation, rotation, scale); } } diff --git a/tiny_skia/src/vector.rs b/tiny_skia/src/vector.rs index 5150cffe..8e3463f2 100644 --- a/tiny_skia/src/vector.rs +++ b/tiny_skia/src/vector.rs @@ -4,6 +4,7 @@ use crate::graphics::text; use resvg::usvg::{self, TreeTextToPath}; use rustc_hash::{FxHashMap, FxHashSet}; +use tiny_skia::Transform; use std::cell::RefCell; use std::collections::hash_map; @@ -34,6 +35,7 @@ impl Pipeline { color: Option, bounds: Rectangle, pixels: &mut tiny_skia::PixmapMut<'_>, + transform: Transform, clip_mask: Option<&tiny_skia::Mask>, ) { if let Some(image) = self.cache.borrow_mut().draw( @@ -46,7 +48,7 @@ impl Pipeline { bounds.y as i32, image, &tiny_skia::PixmapPaint::default(), - tiny_skia::Transform::identity(), + transform, clip_mask, ); } -- cgit From a57313b23ecb9843856ca0ea08635b6121fcb2cb Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 May 2024 15:21:22 +0200 Subject: Simplify image rotation API and its internals --- tiny_skia/src/engine.rs | 26 ++++++++++++++------------ tiny_skia/src/layer.rs | 10 +++------- tiny_skia/src/lib.rs | 11 ++++------- 3 files changed, 21 insertions(+), 26 deletions(-) (limited to 'tiny_skia') diff --git a/tiny_skia/src/engine.rs b/tiny_skia/src/engine.rs index 564d3752..e9935bdb 100644 --- a/tiny_skia/src/engine.rs +++ b/tiny_skia/src/engine.rs @@ -551,7 +551,6 @@ impl Engine { filter_method, bounds, rotation, - scale, } => { let physical_bounds = *bounds * transformation; @@ -563,11 +562,13 @@ impl Engine { .then_some(clip_mask as &_); let center = physical_bounds.center(); - let transform = into_transform(transformation) - .post_rotate_at(rotation.to_degrees(), center.x, center.y) - .post_translate(-center.x, -center.y) - .post_scale(scale.width, scale.height) - .post_translate(center.x, center.y); + let radians = f32::from(*rotation); + + let transform = into_transform(transformation).post_rotate_at( + radians.to_degrees(), + center.x, + center.y, + ); self.raster_pipeline.draw( handle, @@ -584,7 +585,6 @@ impl Engine { color, bounds, rotation, - scale, } => { let physical_bounds = *bounds * transformation; @@ -596,11 +596,13 @@ impl Engine { .then_some(clip_mask as &_); let center = physical_bounds.center(); - let transform = into_transform(transformation) - .post_rotate_at(rotation.to_degrees(), center.x, center.y) - .post_translate(-center.x, -center.y) - .post_scale(scale.width, scale.height) - .post_translate(center.x, center.y); + let radians = f32::from(*rotation); + + let transform = into_transform(transformation).post_rotate_at( + radians.to_degrees(), + center.x, + center.y, + ); self.vector_pipeline.draw( handle, diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs index e9651814..c8a31ba3 100644 --- a/tiny_skia/src/layer.rs +++ b/tiny_skia/src/layer.rs @@ -1,5 +1,5 @@ use crate::core::{ - image, renderer::Quad, svg, Background, Color, Point, Rectangle, Size, + image, renderer::Quad, svg, Background, Color, Point, Radians, Rectangle, Transformation, }; use crate::graphics::damage; @@ -121,15 +121,13 @@ impl Layer { filter_method: image::FilterMethod, bounds: Rectangle, transformation: Transformation, - rotation: f32, - scale: Size, + rotation: Radians, ) { let image = Image::Raster { handle, filter_method, bounds: bounds * transformation, rotation, - scale, }; self.images.push(image); @@ -141,15 +139,13 @@ impl Layer { color: Option, bounds: Rectangle, transformation: Transformation, - rotation: f32, - scale: Size, + rotation: Radians, ) { let svg = Image::Vector { handle, color, bounds: bounds * transformation, rotation, - scale, }; self.images.push(svg); diff --git a/tiny_skia/src/lib.rs b/tiny_skia/src/lib.rs index 4e3ebad3..75aaaf92 100644 --- a/tiny_skia/src/lib.rs +++ b/tiny_skia/src/lib.rs @@ -29,7 +29,7 @@ pub use geometry::Geometry; use crate::core::renderer; use crate::core::{ - Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation, + Background, Color, Font, Pixels, Point, Radians, Rectangle, Transformation, }; use crate::engine::Engine; use crate::graphics::compositor; @@ -377,8 +377,7 @@ impl core::image::Renderer for Renderer { handle: Self::Handle, filter_method: core::image::FilterMethod, bounds: Rectangle, - rotation: f32, - scale: Size, + rotation: Radians, ) { let (layer, transformation) = self.layers.current_mut(); layer.draw_image( @@ -387,7 +386,6 @@ impl core::image::Renderer for Renderer { bounds, transformation, rotation, - scale, ); } } @@ -406,11 +404,10 @@ impl core::svg::Renderer for Renderer { handle: core::svg::Handle, color: Option, bounds: Rectangle, - rotation: f32, - scale: Size, + rotation: Radians, ) { let (layer, transformation) = self.layers.current_mut(); - layer.draw_svg(handle, color, bounds, transformation, rotation, scale); + layer.draw_svg(handle, color, bounds, transformation, rotation); } } -- cgit From 568ac66486937a294f2a79cefea277e4eb46b81e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 May 2024 17:15:26 +0200 Subject: Remove commented code in `tiny_skia::layer` --- tiny_skia/src/layer.rs | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'tiny_skia') diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs index c8a31ba3..c907c93c 100644 --- a/tiny_skia/src/layer.rs +++ b/tiny_skia/src/layer.rs @@ -260,22 +260,6 @@ impl Layer { Image::eq, ); - // let center = bounds.center(); - // let rotated_size = RotationLayout::Change - // .apply_to_size(bounds.size(), *rotation); - // - // let scaled_size = Size::new( - // rotated_size.width * scale.width, - // rotated_size.height * scale.height, - // ); - // - // let top_left = Point::new( - // center.x - scaled_size.width / 2.0, - // center.y - scaled_size.height / 2.0, - // ); - // - // Rectangle::new(top_left, scaled_size).expand(1.0) - damage.extend(text); damage.extend(primitives); damage.extend(images); -- cgit From 15057a05c118dafcb8cf90d4119e66caaa6026c5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 3 May 2024 09:11:46 +0200 Subject: Introduce `center` widget helper ... and also make `center_x` and `center_y` set `width` and `height` to `Length::Fill`, respectively. This targets the most common use case when centering things and removes a bunch of boilerplate as a result. --- tiny_skia/src/engine.rs | 32 ++++++++++++++++---------------- tiny_skia/src/lib.rs | 6 +++--- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'tiny_skia') diff --git a/tiny_skia/src/engine.rs b/tiny_skia/src/engine.rs index e9935bdb..544ff614 100644 --- a/tiny_skia/src/engine.rs +++ b/tiny_skia/src/engine.rs @@ -539,10 +539,10 @@ impl Engine { pub fn draw_image( &mut self, image: &Image, - transformation: Transformation, - pixels: &mut tiny_skia::PixmapMut<'_>, - clip_mask: &mut tiny_skia::Mask, - clip_bounds: Rectangle, + _transformation: Transformation, + _pixels: &mut tiny_skia::PixmapMut<'_>, + _clip_mask: &mut tiny_skia::Mask, + _clip_bounds: Rectangle, ) { match image { #[cfg(feature = "image")] @@ -552,19 +552,19 @@ impl Engine { bounds, rotation, } => { - let physical_bounds = *bounds * transformation; + let physical_bounds = *bounds * _transformation; - if !clip_bounds.intersects(&physical_bounds) { + if !_clip_bounds.intersects(&physical_bounds) { return; } - let clip_mask = (!physical_bounds.is_within(&clip_bounds)) - .then_some(clip_mask as &_); + let clip_mask = (!physical_bounds.is_within(&_clip_bounds)) + .then_some(_clip_mask as &_); let center = physical_bounds.center(); let radians = f32::from(*rotation); - let transform = into_transform(transformation).post_rotate_at( + let transform = into_transform(_transformation).post_rotate_at( radians.to_degrees(), center.x, center.y, @@ -574,7 +574,7 @@ impl Engine { handle, *filter_method, *bounds, - pixels, + _pixels, transform, clip_mask, ); @@ -586,19 +586,19 @@ impl Engine { bounds, rotation, } => { - let physical_bounds = *bounds * transformation; + let physical_bounds = *bounds * _transformation; - if !clip_bounds.intersects(&physical_bounds) { + if !_clip_bounds.intersects(&physical_bounds) { return; } - let clip_mask = (!physical_bounds.is_within(&clip_bounds)) - .then_some(clip_mask as &_); + let clip_mask = (!physical_bounds.is_within(&_clip_bounds)) + .then_some(_clip_mask as &_); let center = physical_bounds.center(); let radians = f32::from(*rotation); - let transform = into_transform(transformation).post_rotate_at( + let transform = into_transform(_transformation).post_rotate_at( radians.to_degrees(), center.x, center.y, @@ -608,7 +608,7 @@ impl Engine { handle, *color, physical_bounds, - pixels, + _pixels, transform, clip_mask, ); diff --git a/tiny_skia/src/lib.rs b/tiny_skia/src/lib.rs index 75aaaf92..e0cbfa0d 100644 --- a/tiny_skia/src/lib.rs +++ b/tiny_skia/src/lib.rs @@ -29,7 +29,7 @@ pub use geometry::Geometry; use crate::core::renderer; use crate::core::{ - Background, Color, Font, Pixels, Point, Radians, Rectangle, Transformation, + Background, Color, Font, Pixels, Point, Rectangle, Transformation, }; use crate::engine::Engine; use crate::graphics::compositor; @@ -377,7 +377,7 @@ impl core::image::Renderer for Renderer { handle: Self::Handle, filter_method: core::image::FilterMethod, bounds: Rectangle, - rotation: Radians, + rotation: core::Radians, ) { let (layer, transformation) = self.layers.current_mut(); layer.draw_image( @@ -404,7 +404,7 @@ impl core::svg::Renderer for Renderer { handle: core::svg::Handle, color: Option, bounds: Rectangle, - rotation: Radians, + rotation: core::Radians, ) { let (layer, transformation) = self.layers.current_mut(); layer.draw_svg(handle, color, bounds, transformation, rotation); -- cgit From fa9e1d96ea1924b51749b775ea0e67e69bc8a305 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 3 May 2024 13:25:58 +0200 Subject: Introduce dynamic `opacity` support for `Image` and `Svg` --- tiny_skia/src/engine.rs | 4 ++++ tiny_skia/src/layer.rs | 4 ++++ tiny_skia/src/lib.rs | 12 +++++++++++- tiny_skia/src/raster.rs | 2 ++ tiny_skia/src/vector.rs | 6 +++++- 5 files changed, 26 insertions(+), 2 deletions(-) (limited to 'tiny_skia') diff --git a/tiny_skia/src/engine.rs b/tiny_skia/src/engine.rs index 544ff614..028b304f 100644 --- a/tiny_skia/src/engine.rs +++ b/tiny_skia/src/engine.rs @@ -551,6 +551,7 @@ impl Engine { filter_method, bounds, rotation, + opacity, } => { let physical_bounds = *bounds * _transformation; @@ -574,6 +575,7 @@ impl Engine { handle, *filter_method, *bounds, + *opacity, _pixels, transform, clip_mask, @@ -585,6 +587,7 @@ impl Engine { color, bounds, rotation, + opacity, } => { let physical_bounds = *bounds * _transformation; @@ -608,6 +611,7 @@ impl Engine { handle, *color, physical_bounds, + *opacity, _pixels, transform, clip_mask, diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs index c907c93c..48fca1d8 100644 --- a/tiny_skia/src/layer.rs +++ b/tiny_skia/src/layer.rs @@ -122,12 +122,14 @@ impl Layer { bounds: Rectangle, transformation: Transformation, rotation: Radians, + opacity: f32, ) { let image = Image::Raster { handle, filter_method, bounds: bounds * transformation, rotation, + opacity, }; self.images.push(image); @@ -140,12 +142,14 @@ impl Layer { bounds: Rectangle, transformation: Transformation, rotation: Radians, + opacity: f32, ) { let svg = Image::Vector { handle, color, bounds: bounds * transformation, rotation, + opacity, }; self.images.push(svg); diff --git a/tiny_skia/src/lib.rs b/tiny_skia/src/lib.rs index e0cbfa0d..1aabff00 100644 --- a/tiny_skia/src/lib.rs +++ b/tiny_skia/src/lib.rs @@ -378,6 +378,7 @@ impl core::image::Renderer for Renderer { filter_method: core::image::FilterMethod, bounds: Rectangle, rotation: core::Radians, + opacity: f32, ) { let (layer, transformation) = self.layers.current_mut(); layer.draw_image( @@ -386,6 +387,7 @@ impl core::image::Renderer for Renderer { bounds, transformation, rotation, + opacity, ); } } @@ -405,9 +407,17 @@ impl core::svg::Renderer for Renderer { color: Option, bounds: Rectangle, rotation: core::Radians, + opacity: f32, ) { let (layer, transformation) = self.layers.current_mut(); - layer.draw_svg(handle, color, bounds, transformation, rotation); + layer.draw_svg( + handle, + color, + bounds, + transformation, + rotation, + opacity, + ); } } diff --git a/tiny_skia/src/raster.rs b/tiny_skia/src/raster.rs index 907fce7c..c40f55b2 100644 --- a/tiny_skia/src/raster.rs +++ b/tiny_skia/src/raster.rs @@ -31,6 +31,7 @@ impl Pipeline { handle: &raster::Handle, filter_method: raster::FilterMethod, bounds: Rectangle, + opacity: f32, pixels: &mut tiny_skia::PixmapMut<'_>, transform: tiny_skia::Transform, clip_mask: Option<&tiny_skia::Mask>, @@ -56,6 +57,7 @@ impl Pipeline { image, &tiny_skia::PixmapPaint { quality, + opacity, ..Default::default() }, transform, diff --git a/tiny_skia/src/vector.rs b/tiny_skia/src/vector.rs index 8e3463f2..bbe08cb8 100644 --- a/tiny_skia/src/vector.rs +++ b/tiny_skia/src/vector.rs @@ -34,6 +34,7 @@ impl Pipeline { handle: &Handle, color: Option, bounds: Rectangle, + opacity: f32, pixels: &mut tiny_skia::PixmapMut<'_>, transform: Transform, clip_mask: Option<&tiny_skia::Mask>, @@ -47,7 +48,10 @@ impl Pipeline { bounds.x as i32, bounds.y as i32, image, - &tiny_skia::PixmapPaint::default(), + &tiny_skia::PixmapPaint { + opacity, + ..tiny_skia::PixmapPaint::default() + }, transform, clip_mask, ); -- cgit