[cairo] Suboptimal color calculation in PDF backend

Behdad Esfahbod behdad at cs.toronto.edu
Fri Oct 7 13:36:34 PDT 2005


Hi,


I think this code in the PDF backend:

        stops[i].color_char[0] = pattern->stops[i].color.red   * 0xff + 0.5;
        stops[i].color_char[1] = pattern->stops[i].color.green * 0xff + 0.5;
        stops[i].color_char[2] = pattern->stops[i].color.blue  * 0xff + 0.5;
        stops[i].color_char[3] = pattern->stops[i].color.alpha * 0xff + 0.5;


should be changed to something like this:

        stops[i].color_char[0] = pattern->stops[i].color.red   * (256 - 1e-5);


Search for CAIRO_COLOR_ONE_MINUS_EPSILON in cairo-color.c, it's
the same.


--behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
	-- Dan Bern, "New American Language"


More information about the cairo mailing list