Respect SVG image-rendering pixelated attribute

This commit is contained in:
Shunsuke Yoshizawa
2026-10-31 20:44:09 +07:00
committed by bflatastic
parent 6664e366e7
commit aaeb1b2b35
+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.