mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
Playing with image export and svg generation
This commit is contained in:
@@ -266,16 +266,16 @@ pub unsafe extern "C" fn draw_shapes(state: *mut State, ptr: *mut Rect, len: usi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// base64 image of the canvas
|
// base64 image of the canvas
|
||||||
// let image = state.surface.image_snapshot();
|
let image = state.surface.image_snapshot();
|
||||||
// let mut context = state.surface.direct_context();
|
let mut context = state.surface.direct_context();
|
||||||
// let encoded_image = image.encode(context.as_mut(), EncodedImageFormat::PNG, None).unwrap();
|
let encoded_image = image.encode(context.as_mut(), EncodedImageFormat::PNG, None).unwrap();
|
||||||
// let base64_image = base64::encode(&encoded_image.as_bytes());
|
let base64_image = base64::encode(&encoded_image.as_bytes());
|
||||||
// println!("data:image/png;base64,{}", base64_image);
|
println!("data:image/png;base64,{}", base64_image);
|
||||||
|
|
||||||
// SVG representation
|
// SVG representation
|
||||||
// let svg_data = svg_canvas.end();
|
let svg_data = svg_canvas.end();
|
||||||
// let svg = String::from_utf8_lossy(svg_data.as_bytes());
|
let svg = String::from_utf8_lossy(svg_data.as_bytes());
|
||||||
// println!("svg: {}", svg);
|
println!("svg: {}", svg.replace('\n', ""));
|
||||||
|
|
||||||
flush(state);
|
flush(state);
|
||||||
std::mem::forget(buf);
|
std::mem::forget(buf);
|
||||||
|
|||||||
@@ -9192,6 +9192,17 @@ function invoke_iif(index,a1,a2) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) {
|
||||||
|
var sp = stackSave();
|
||||||
|
try {
|
||||||
|
getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6);
|
||||||
|
} catch(e) {
|
||||||
|
stackRestore(sp);
|
||||||
|
if (!(e instanceof EmscriptenEH)) throw e;
|
||||||
|
_setThrew(1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function invoke_iiiiffii(index,a1,a2,a3,a4,a5,a6,a7) {
|
function invoke_iiiiffii(index,a1,a2,a3,a4,a5,a6,a7) {
|
||||||
var sp = stackSave();
|
var sp = stackSave();
|
||||||
try {
|
try {
|
||||||
@@ -9225,17 +9236,6 @@ function invoke_viiff(index,a1,a2,a3,a4) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) {
|
|
||||||
var sp = stackSave();
|
|
||||||
try {
|
|
||||||
getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6);
|
|
||||||
} catch(e) {
|
|
||||||
stackRestore(sp);
|
|
||||||
if (!(e instanceof EmscriptenEH)) throw e;
|
|
||||||
_setThrew(1, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function invoke_viiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9) {
|
function invoke_viiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9) {
|
||||||
var sp = stackSave();
|
var sp = stackSave();
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user