[cairo] Drawing problem with 1.12.14

Mark Leisher mleisher at gmail.com
Tue Jun 18 12:29:21 PDT 2013


My apologies if this has been addressed already. I couldn't find an 
answer in the archives with a few searches, so I'm doing the lazy thing 
first.

In the code below, drawing occurs correctly when the RGBA colors are:

   fg = {0.0,0.0,0.0,1.0};
   bg = {0.0,0.0,0.0,0.0};

but does not when:

   fg = {0.0,0.0,0.0,0.0};
   bg = {0.0,0.0,0.0,1.0};

The second color pair paints the background rectangle in black 
correctly, but does not paint on top of that background using the 
foreground color. This is with the operator being CAIRO_OPERATOR_OVER.

Basically, I am taking a small rectangle of the window and inverting the 
contents by redrawing with the background and foreground colors 
switched. This used to work in cairo 1.10, so I must have missed a 
change somewhere between 1.10 and 1.12.

/*
  * Clear the background and then set the foreground color.
  */
  cairo_set_source_rgba(cr,bg.red,bg.green,bg.blue,bg.alpha);
  cairo_rectangle(cr,cx+2,cy+p->label_height+2,p->cell_width-3,
                  (p->cell_height - (p->label_height + 3)));
  cairo_fill(cr);
  cairo_set_source_rgba(cr,fg.red,fg.green,fg.blue,fg.alpha);


-- 
Mark Leisher


More information about the cairo mailing list