[cairo] OPERATOR_SRC and no input

Stefan Krause Stefan.Krause at gmx.at
Sun Jan 9 04:33:25 PST 2005


When I'm rendering a path that doesn't fill its bounding box completely 
the image and xrender backend produces different output than the glitz 
backend, e.g:

// fill background with white color
  cairo_set_rgb_color (cr, 1.0, 1.0, 1.0);
  cairo_set_alpha (cr, 1.0);
  cairo_set_operator (cr, CAIRO_OPERATOR_SRC);
  cairo_rectangle (cr, 0, 0, w, h);
  cairo_fill (cr);

// now paint my path
  cairo_set_operator (cr, CAIRO_OPERATOR_SRC);
  cairo_set_alpha (cr, 1.0);
  cairo_set_rgb_color (cr, 1.0, 0.0, 1.0);
  cairo_move_to (cr, 100, 0);
  cairo_line_to (cr, 200, 100);
  cairo_line_to (cr, 100, 200);
  cairo_line_to (cr, 0, 100);
  cairo_close_path(cr);
  cairo_fill(cr);

This will fill a path in a purple color and lets the background shine 
through for the glitz backend. For the image and xrender backend the 
bounding box of the path is filled black. I'd say glitz interpretation 
of "no input" is correct, but you'll certainly know the Porter and Duff 
rules better than I do.

Yours,
Stefan



More information about the cairo mailing list