mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 16:00:19 -05:00
Playing with image export and svg generation
This commit is contained in:
parent
dfe5d861f2
commit
6d5b0204e9
1 changed files with 3 additions and 0 deletions
|
@ -241,11 +241,13 @@ pub unsafe extern "C" fn draw_shapes(state: *mut State, ptr: *mut Rect, len: usi
|
||||||
|
|
||||||
text_paint.set_color(color);
|
text_paint.set_color(color);
|
||||||
state.surface.canvas().draw_str("SKIA TEXT", (rect.left, rect.top), &state.default_font, &text_paint);
|
state.surface.canvas().draw_str("SKIA TEXT", (rect.left, rect.top), &state.default_font, &text_paint);
|
||||||
|
svg_canvas.draw_str("SKIA TEXT", (rect.left, rect.top), &state.default_font, &text_paint);
|
||||||
|
|
||||||
let mut path = Path::new();
|
let mut path = Path::new();
|
||||||
path.move_to((rect.left, rect.top));
|
path.move_to((rect.left, rect.top));
|
||||||
path.line_to((rect.right, rect.bottom));
|
path.line_to((rect.right, rect.bottom));
|
||||||
state.surface.canvas().draw_path(&path, &path_paint);
|
state.surface.canvas().draw_path(&path, &path_paint);
|
||||||
|
svg_canvas.draw_path(&path, &path_paint);
|
||||||
|
|
||||||
// https://github.com/rust-skia/rust-skia/blob/02c89a87649af8d2870fb631aae4a5e171887367/skia-org/src/skparagraph_example.rs#L18
|
// https://github.com/rust-skia/rust-skia/blob/02c89a87649af8d2870fb631aae4a5e171887367/skia-org/src/skparagraph_example.rs#L18
|
||||||
let mut font_collection = FontCollection::new();
|
let mut font_collection = FontCollection::new();
|
||||||
|
@ -260,6 +262,7 @@ pub unsafe extern "C" fn draw_shapes(state: *mut State, ptr: *mut Rect, len: usi
|
||||||
let mut paragraph = paragraph_builder.build();
|
let mut paragraph = paragraph_builder.build();
|
||||||
paragraph.layout(256.0);
|
paragraph.layout(256.0);
|
||||||
paragraph.paint(state.surface.canvas(), (rect.left, rect.top));
|
paragraph.paint(state.surface.canvas(), (rect.left, rect.top));
|
||||||
|
paragraph.paint(&svg_canvas, (rect.left, rect.top));
|
||||||
}
|
}
|
||||||
|
|
||||||
// base64 image of the canvas
|
// base64 image of the canvas
|
||||||
|
|
Loading…
Reference in a new issue