Introduce dynamic opacity support for Image and Svg
This commit is contained in:
parent
38cf87cb45
commit
fa9e1d96ea
18 changed files with 142 additions and 33 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<Color>,
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ impl Pipeline {
|
|||
handle: &Handle,
|
||||
color: Option<Color>,
|
||||
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,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue