[cairo] Trouble scaling down images.

Tristen Ennemuist tristen_e at yahoo.com
Fri Apr 8 09:03:40 PDT 2011


hello all
i've written some code to scale an image down, however the quality of the downsized image is poor compared to how the gimp or eog scales down.
i'm probably doing something wrong of course. a snippet from a class i've written:
	cairo_surface_t *new_surface = ::cairo_image_surface_create(this->format, new_width, new_height);
	cairo_t *new_cr = ::cairo_create(new_surface);
	::cairo_scale(new_cr, ratio, ratio);
	::cairo_set_source_surface(new_cr, this->surface, 0, 0);
	::cairo_pattern_set_filter(::cairo_get_source(new_cr), CAIRO_FILTER_BEST);	::cairo_pattern_set_extend(::cairo_get_source(new_cr), CAIRO_EXTEND_PAD);
	::cairo_paint(new_cr);
it doesn't seem to matter which pattern i use for cairo_pattern_set_filter the results appear to always be very similar. i must therefore be doing something incorrectly?
any help would be very much appreciated.
tristen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110408/3da91778/attachment.htm>


More information about the cairo mailing list