mirror of
https://github.com/penpot/penpot.git
synced 2025-07-19 13:57:20 +02:00
🎉 Render wasm ellipses support
This commit is contained in:
parent
33e70a4108
commit
307329cf2e
6 changed files with 67 additions and 7 deletions
|
@ -7,6 +7,8 @@ mod state;
|
|||
mod utils;
|
||||
mod view;
|
||||
|
||||
use crate::shapes::Kind;
|
||||
use crate::shapes::Path;
|
||||
use skia_safe as skia;
|
||||
|
||||
use crate::state::State;
|
||||
|
@ -102,6 +104,33 @@ pub extern "C" fn use_shape(a: u32, b: u32, c: u32, d: u32) {
|
|||
state.use_shape(id);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn set_shape_kind_circle() {
|
||||
let state = unsafe { STATE.as_mut() }.expect("got an invalid state pointer");
|
||||
|
||||
if let Some(shape) = state.current_shape() {
|
||||
shape.kind = Kind::Circle(math::Rect::new_empty());
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn set_shape_kind_rect() {
|
||||
let state = unsafe { STATE.as_mut() }.expect("got an invalid state pointer");
|
||||
|
||||
if let Some(shape) = state.current_shape() {
|
||||
shape.kind = Kind::Rect(math::Rect::new_empty());
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn set_shape_kind_path() {
|
||||
let state = unsafe { STATE.as_mut() }.expect("got an invalid state pointer");
|
||||
if let Some(shape) = state.current_shape() {
|
||||
let p = Path::try_from(Vec::new()).unwrap();
|
||||
shape.kind = Kind::Path(p);
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn set_shape_selrect(left: f32, top: f32, right: f32, bottom: f32) {
|
||||
let state = unsafe { STATE.as_mut() }.expect("got an invalid state pointer");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue