mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 19:08:05 +08:00
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:
committed by
Keavon Chambers
parent
34f2d61257
commit
e1cdb2242d
@@ -297,12 +297,7 @@ impl GraphicElementRendered for ImageFrame<Color> {
|
||||
if image.data.is_empty() {
|
||||
return;
|
||||
}
|
||||
let (flat_data, _, _) = image.clone().into_flat_u8();
|
||||
let mut output = Vec::new();
|
||||
let encoder = image::codecs::png::PngEncoder::new(&mut output);
|
||||
encoder
|
||||
.write_image(&flat_data, image.width, image.height, image::ColorType::Rgba8)
|
||||
.expect("failed to encode image as png");
|
||||
let output = image.to_png();
|
||||
let preamble = "data:image/png;base64,";
|
||||
let mut base64_string = String::with_capacity(preamble.len() + output.len() * 4);
|
||||
base64_string.push_str(preamble);
|
||||
|
||||
Reference in New Issue
Block a user