Lay Groundwork for Rust-based SVG rasterization (#1422)

* Add functions for constructing a usvg tree

* Actually encode the image in the usvg tree

* Implement path translation

* Render document using resvg
This commit is contained in:
Dennis Kobert
2023-09-30 11:43:24 +02:00
committed by Keavon Chambers
parent 34f2d61257
commit e1cdb2242d
10 changed files with 585 additions and 46 deletions

View File

@@ -184,7 +184,7 @@ impl NodeRuntime {
resolution: viewport_resolution,
..Default::default()
},
export_format: graphene_core::application_io::ExportFormat::Svg,
export_format: graphene_core::application_io::ExportFormat::Canvas,
},
image_frame: None,
};
@@ -402,7 +402,7 @@ impl NodeGraphExecutor {
use image::{ImageBuffer, Rgba};
use std::io::Cursor;
let (result_bytes, width, height) = image.into_flat_u8();
let (result_bytes, width, height) = image.to_flat_u8();
let mut output: ImageBuffer<Rgba<u8>, _> = image::ImageBuffer::from_raw(width, height, result_bytes).ok_or_else(|| "Invalid image size".to_string())?;
if let Some(size) = resize {