[cairo] nearest neighborhood or bilinear interpolation

Bill Spitzak spitzak at d2.com
Tue Oct 31 11:30:33 PST 2006



Carlos Eduardo Rodrigues Diógenes wrote:
> Hi Bill,
> 
> I don't understand what you said in #2, can you give examples?
> 
> Best regards,
> Carlos.

In most modern graphics api's, zooming an image by a factor of 10 
produces an image like this:

http://www.syntheticsw.com/~spitzak/smooth.png

However often the user and programmer expects an image more like this:

http://www.syntheticsw.com/~spitzak/blocky.png

They then think they want to turn off filtering. Indeed for an integer 
zoom and no other transform, it will produce the above image.

However if you add a rotation, no filtering will produce this image:

http://www.syntheticsw.com/~spitzak/impulse.png

But it may be preferrable to get this image, which is the result of 
ignoring sampling theory and making the sampling filter get smaller than 
one pixel:

http://www.syntheticsw.com/~spitzak/smoothblocky.png

In fact I think perhaps this last result is what Cairo should do by default.


More information about the cairo mailing list