[cairo] Trouble scaling down images.
tristen_e at yahoo.com
Fri Apr 8 09:03:40 PDT 2011
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);
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo