mirror of
https://github.com/penpot/penpot.git
synced 2025-05-18 07:46: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
|
@ -596,6 +596,33 @@ pub extern "C" fn set_shape_path_attrs(num_attrs: u32) {
|
|||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn add_shape_shadow(
|
||||
raw_color: u32,
|
||||
blur: f32,
|
||||
spread: f32,
|
||||
x: f32,
|
||||
y: f32,
|
||||
raw_style: u8,
|
||||
hidden: bool,
|
||||
) {
|
||||
let state = unsafe { STATE.as_mut() }.expect("got an invalid state pointer");
|
||||
if let Some(shape) = state.current_shape() {
|
||||
let color = skia::Color::new(raw_color);
|
||||
let style = shapes::ShadowStyle::from(raw_style);
|
||||
let shadow = shapes::Shadow::new(color, blur, spread, (x, y), style, hidden);
|
||||
shape.add_shadow(shadow);
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn clear_shape_shadows() {
|
||||
let state = unsafe { STATE.as_mut() }.expect("got an invalid state pointer");
|
||||
if let Some(shape) = state.current_shape() {
|
||||
shape.clear_shadows();
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
init_gl();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue