This version uses the private PremultipliedColorU8::from_rgba_unchecked function to build pixels. I swapped this for the public PremultipliedColorU8::from_rgba function, which returns an Option that I unwraped. But it turns out the checked part is triggered for some pixels for the images in the VegaFusion test suite. This PR uses min to clamp the rgb values to the alpha value (which is what from_rgba checks).
Closes #94
In 0.13.0, the
encode_png
function was copied from tiny-skia and modified to support theppi
. The tiny-skia version is here:https://github.com/RazrFalcon/tiny-skia/blob/d2b7abbde312a18f4c62ddc7201a32eb6e1a146f/src/pixmap.rs#L390-L419
This version uses the private
PremultipliedColorU8::from_rgba_unchecked
function to build pixels. I swapped this for the publicPremultipliedColorU8::from_rgba
function, which returns an Option that I unwraped. But it turns out the checked part is triggered for some pixels for the images in the VegaFusion test suite. This PR usesmin
to clamp the rgb values to the alpha value (which is whatfrom_rgba
checks).