Serialize stroke solid fills as bytes (wasm)

This commit is contained in:
Belén Albeza 2025-04-29 16:26:20 +02:00
parent 093fa18839
commit 5ae125db94
2 changed files with 11 additions and 5 deletions

View file

@ -34,11 +34,13 @@ pub extern "C" fn add_shape_outer_stroke(width: f32, style: u8, cap_start: u8, c
}
#[no_mangle]
pub extern "C" fn add_shape_stroke_solid_fill(raw_color: u32) {
pub extern "C" fn add_shape_stroke_solid_fill() {
with_current_shape!(state, |shape: &mut Shape| {
let color = skia::Color::new(raw_color);
let bytes = mem::bytes();
let solid_color =
shapes::SolidColor::try_from(&bytes[..]).expect("Invalid solid color data");
shape
.set_stroke_fill(shapes::Fill::Solid(shapes::SolidColor(color)))
.set_stroke_fill(shapes::Fill::Solid(solid_color))
.expect("could not add stroke solid fill");
});
}