mirror of
https://github.com/penpot/penpot.git
synced 2025-06-14 17:41:39 +02:00
♻️ Move rendering a single shape to the shape itself
This commit is contained in:
parent
001aa3f319
commit
967bc75a1c
5 changed files with 121 additions and 72 deletions
28
render-wasm/src/render/blend.rs
Normal file
28
render-wasm/src/render/blend.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
use skia_safe as skia;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||
pub struct BlendMode(skia::BlendMode);
|
||||
|
||||
impl Default for BlendMode {
|
||||
fn default() -> Self {
|
||||
BlendMode(skia::BlendMode::SrcOver)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<i32> for BlendMode {
|
||||
fn from(value: i32) -> Self {
|
||||
if value <= skia::BlendMode::Luminosity as i32 {
|
||||
unsafe { Self(std::mem::transmute(value)) }
|
||||
} else {
|
||||
Self::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<skia::BlendMode> for BlendMode {
|
||||
fn into(self) -> skia::BlendMode {
|
||||
match self {
|
||||
Self(skia_blend) => skia_blend,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue