On 2013-03-28 22:45, Josh Andler wrote:
Hey Krzysztof,
In speaking with ~suv, not unexpected, but of course there was an issue she observed and I think it's a problem. :) Basically it was with an unscaled QR code image that was imported and aligned to the pixel grid and then zoomed in on. Comparison screenshot http://dl.dropbox.com/u/65084033/irc/bitmap-sampling-screenshot-r12226-r1222... The left side is before Jasper's change.
I did a test here on my end and yeah, it's definitely unexpected that it's increasing the antialiasing as you increase the zoom. Possibly an unintended bug, but if not it's a regression that's not worth the trade off imho.
This is basically just a choice, and completely expected (and quite desirable in many cases). My code only deals with DOWNscaling, upscaling is done using Cairo. However, while implementing this work-around, I removed the check that set the interpolation to nearest when upscaling, as I figured it might have been some weird work-around. I guess it was probably put in to have "nicer" upscaling of pixelized bitmaps, but for photographs it does not really make sense. Also, the standard essentially suggests to use at least bilinear interpolation.
Ideally, we would allow users to set a rendering hint (like shape-rendering) to decide what they prefer. However, there does not appear to be a proper hint in the standard (image-rendering mostly stresses the speed, but I guess it could be hijacked). Also, there is no guarantee other renderers make the same choice we do. In general it is probably a bad idea to rely on pixels being upscaled as flat rectangles, as this is quite uncommon behaviour.
Still, since photographs and such are typically downscaled, I would be okay with bringing back the old code. Or just remove the scale clamping from my "hack". This will have a similar effect, with slight anti-aliasing if the upscaled pixels do not fully align with the target raster.