mirror of
https://github.com/penpot/penpot.git
synced 2025-06-15 07:31:38 +02:00
🎉 Feat masks
This commit is contained in:
parent
3ea52a0198
commit
f8d58cb74e
9 changed files with 249 additions and 102 deletions
|
@ -39,7 +39,7 @@ pub fn render_wasm_label(render_state: &mut RenderState) {
|
|||
canvas.draw_str("WASM RENDERER", p, &font, &paint);
|
||||
}
|
||||
|
||||
pub fn render_debug_element(render_state: &mut RenderState, element: &Shape, intersected: bool) {
|
||||
pub fn render_debug_shape(render_state: &mut RenderState, element: &Shape, intersected: bool) {
|
||||
let mut paint = skia::Paint::default();
|
||||
paint.set_style(skia::PaintStyle::Stroke);
|
||||
paint.set_color(if intersected {
|
||||
|
|
|
@ -78,6 +78,7 @@ fn draw_image_fill_in_container(
|
|||
Kind::SVGRaw(_) => {
|
||||
canvas.clip_rect(container, skia::ClipOp::Intersect, true);
|
||||
}
|
||||
Kind::Group(_) => unreachable!("A group should not have fills"),
|
||||
}
|
||||
|
||||
// Draw the image with the calculated destination rectangle
|
||||
|
@ -123,6 +124,6 @@ pub fn render(render_state: &mut RenderState, shape: &Shape, fill: &Fill) {
|
|||
canvas.draw_path(&skia_path, &fill.to_paint(&selrect));
|
||||
}
|
||||
}
|
||||
(_, _) => todo!(),
|
||||
(_, _) => unreachable!("This shape should not have fills"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ fn draw_image_stroke_in_container(
|
|||
Kind::Circle(rect) => {
|
||||
draw_stroke_on_circle(canvas, stroke, rect, &outer_rect, svg_attrs, dpr_scale)
|
||||
}
|
||||
Kind::SVGRaw(_) => todo!(),
|
||||
Kind::SVGRaw(_) | Kind::Group(_) => unreachable!("This shape should not have strokes"),
|
||||
Kind::Path(p) | Kind::Bool(_, p) => {
|
||||
canvas.save();
|
||||
let mut path = p.to_skia_path();
|
||||
|
@ -457,7 +457,7 @@ pub fn render(render_state: &mut RenderState, shape: &Shape, stroke: &Stroke) {
|
|||
dpr_scale,
|
||||
);
|
||||
}
|
||||
Kind::SVGRaw(_) => todo!(),
|
||||
Kind::SVGRaw(_) | Kind::Group(_) => unreachable!("This shape should not have strokes"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue