Merge pull request #4888 from yssy1982/fix-svg-image-rendering

Respect SVG image-rendering pixelated attribute
This commit is contained in:
BFlat
2026-10-31 21:02:50 +07:00
committed by GitHub
+8 -2
View File
@@ -652,10 +652,16 @@ impl Importer {
if link.is_some() && !missing { blob.with_proxy() } else { blob }
});
let xf = acc * Affine::scale_non_uniform(size.width() as f64 / pw as f64, size.height() as f64 / ph as f64);
self.named(
let mut node = self.named(
i.id(),
NodeKind::Image(Box::new(ImageObject { key, width: pw, height: ph, xf, link, placement: Default::default(), pixels: None })),
)
)?;
if i.rendering_mode() == usvg::ImageRendering::Pixelated {
node.extras_mut().pixelated = true;
}
Some(node)
}
/// An SVG shown as an image (a data URL or a linked file) → its art, `acc` mapping its size.