mirror of
https://github.com/penpot/penpot.git
synced 2025-05-22 22:46:10 +02:00
🎉 Deserialize shape data in wasm
This commit is contained in:
parent
22b01c63b5
commit
0bfcc1f854
6 changed files with 140 additions and 18 deletions
|
@ -11,9 +11,10 @@ pub use fills::*;
|
|||
pub use images::*;
|
||||
pub use paths::*;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Kind {
|
||||
Rect,
|
||||
Path(Path),
|
||||
}
|
||||
|
||||
pub type Color = skia::Color;
|
||||
|
@ -110,6 +111,12 @@ impl Shape {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_path_segments(&mut self, buffer: Vec<RawPathData>) -> Result<(), String> {
|
||||
let p = Path::try_from(buffer)?;
|
||||
self.kind = Kind::Path(p);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_blend_mode(&mut self, mode: BlendMode) {
|
||||
self.blend_mode = mode;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue