Skip to content

Commit

Permalink
Fix SVG rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jun 26, 2023
1 parent b26c5ba commit fce1b2b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/view/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,13 @@ impl ViewResource {
h * scale,
)?;

writeln!(out, "<g shape-rendering=\"crispEdges\">")?;

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,
Expand All @@ -163,6 +165,7 @@ impl ViewResource {
)?;
}

writeln!(out, "</g>")?;
writeln!(out, "</svg>")?;

Ok((w * h * scale) as usize)
Expand Down

0 comments on commit fce1b2b

Please sign in to comment.