[cairo] Image downscaling

Krzysztof Kosiński tweenk.pl at gmail.com
Thu Jul 21 19:51:15 PDT 2011


Hello

Since Inkscape trunk switched to Cairo for all rendering, the lack of
real image downscaling in Pixman is starting to affect users.

https://bugs.launchpad.net/inkscape/+bug/804162

Some time ago I tried implementing supersampling in Pixman. The
approach I took was to automatically increase the number of samples
per pixel so that one sample corresponded to roughly one pixel of the
source. To compute the transformed image, for each destination pixel I
would compute a grid of subpixels, obtain color values of the source
corresponding to each subpixel with the current interpolation setting
(e.g. linear interpolation if the filter was CAIRO_FILTER_LINEAR), and
average them together. The end result wasn't perfect, but it was still
far better than the current situation.

I would like to know what algorithm I should use. To be 100% correct,
I would need to compute an inverse transformation matrix to compute
the filter value for each source pixel, but since Pixman uses 16.16
fixed point numbers in the matrix, this could lead to numerical
problems.

Ideally, someone more experienced than me could implement this :)

Regards, Krzysztof


More information about the cairo mailing list