[cairo] antialias for images?
peter.gtz2 at gmail.com
Sun Oct 14 16:24:35 PDT 2007
I'm trying to scale and rotate an image and then put it on a surface
using paint as it is shown in one of the examples.
However the scaling is not done by something like a bicubic filter but
just by a linear one, so the picture looks very noisy (see screenshot
attached) and has a staircase effect on the edges.
Is there a way to make it look smooth? Some antialias for images? I
haven't found something in the mail-archives.
Thanks for your help!
int main (int argc, char *argv)
int w, h;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 256, 256);
cr = cairo_create (surface);
image = cairo_image_surface_create_from_png ("test.png");
w = cairo_image_surface_get_width (image);
h = cairo_image_surface_get_height (image);
cairo_translate (cr, 128.0, 128.0);
cairo_rotate (cr, 20* M_PI/180);
cairo_scale (cr, 256.0/w, 256.0/h);
cairo_translate (cr, -0.5*w, -0.5*h);
cairo_set_source_surface (cr, image, 0, 0);
cairo_surface_write_to_png (surface, "output.png");
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 47960 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071015/cb14c4d6/attachment-0001.png
More information about the cairo