mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 17:56:11 +02:00
🎉 Render drop shadows (wasm) (#5693)
Co-authored-by: Belén Albeza <belen@hey.com>
This commit is contained in:
parent
27dce6fcfa
commit
09131f7533
7 changed files with 217 additions and 3 deletions
|
@ -10,6 +10,7 @@ mod bools;
|
|||
mod fills;
|
||||
mod matrix;
|
||||
mod paths;
|
||||
mod shadows;
|
||||
mod strokes;
|
||||
mod svgraw;
|
||||
|
||||
|
@ -18,6 +19,7 @@ pub use bools::*;
|
|||
pub use fills::*;
|
||||
use matrix::*;
|
||||
pub use paths::*;
|
||||
pub use shadows::*;
|
||||
pub use strokes::*;
|
||||
pub use svgraw::*;
|
||||
|
||||
|
@ -53,6 +55,7 @@ pub struct Shape {
|
|||
pub hidden: bool,
|
||||
pub svg: Option<skia::svg::Dom>,
|
||||
pub svg_attrs: HashMap<String, String>,
|
||||
shadows: Vec<Shadow>,
|
||||
}
|
||||
|
||||
impl Shape {
|
||||
|
@ -73,6 +76,7 @@ impl Shape {
|
|||
blur: Blur::default(),
|
||||
svg: None,
|
||||
svg_attrs: HashMap::new(),
|
||||
shadows: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,6 +309,20 @@ impl Shape {
|
|||
!matches!(self.kind, Kind::SVGRaw(_))
|
||||
}
|
||||
|
||||
pub fn add_shadow(&mut self, shadow: Shadow) {
|
||||
self.shadows.push(shadow);
|
||||
}
|
||||
|
||||
pub fn clear_shadows(&mut self) {
|
||||
self.shadows.clear();
|
||||
}
|
||||
|
||||
pub fn drop_shadows(&self) -> impl DoubleEndedIterator<Item = &Shadow> {
|
||||
self.shadows
|
||||
.iter()
|
||||
.filter(|shadow| shadow.style() == ShadowStyle::Drop)
|
||||
}
|
||||
|
||||
pub fn to_path_transform(&self) -> Option<skia::Matrix> {
|
||||
match self.kind {
|
||||
Kind::Path(_) | Kind::Bool(_, _) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue