From fce1b2bf6bc5da073d6b6aba1a8f4615fd555dc2 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Fri, 2 Jun 2023 23:36:24 +0200 Subject: [PATCH] Fix SVG rendering --- src/view/resource.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/view/resource.rs b/src/view/resource.rs index 0d2d322..cd8e501 100644 --- a/src/view/resource.rs +++ b/src/view/resource.rs @@ -150,11 +150,13 @@ impl ViewResource { h * scale, )?; + writeln!(out, "")?; + for (i, rgba) in pixels.iter().cloned().enumerate().filter(|(_, c)| c.a > 0) { let rgb: Rgb8 = rgba.into(); let x = (i as u32 % w) * scale; - let y = (i as u32 / h) * scale; + let y = (i as u32 / w) * scale; writeln!( out, @@ -163,6 +165,7 @@ impl ViewResource { )?; } + writeln!(out, "")?; writeln!(out, "")?; Ok((w * h * scale) as usize)