[cairo] [PATCHES] gradient color-tolerance/performance work

Adrian Johnson ajohnson at redneon.com
Tue Apr 6 04:58:29 PDT 2010


Chris Toshok wrote:
>     typedef enum _cairo_color_tolerance_level {
>         CAIRO_COLOR_TOLERANCE_HIGH,
>         CAIRO_COLOR_TOLERANCE_MEDIUM,
>         CAIRO_COLOR_TOLERANCE_LOW,
>     } cairo_color_tolerance_t;
> 
>     cairo_public void
>     cairo_pattern_set_color_tolerance (cairo_pattern_t *pattern,
>                        cairo_color_tolerance_t tolerance);
> 

Section 10.6.3 of the PDF specification [1] defines a smoothness 
tolerance for the quality of gradients. This is a value between
0.0 and 1.0 that specifies the maximum permitted error per color
component between the true gradient color and the displayed color.

Something like

   cairo_pattern_set_color_tolerance (double error)

would be more flexible and could be used directly by the PS/PDF 
backends. The mesh gradients branch at [2] might also benefit from
a color tolerance API.


[1] http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf
[2] http://cgit.freedesktop.org/~ajohnson/cairo/log/?h=mesh



More information about the cairo mailing list