cairo draw over alpha

Link to this post 03 Jun 11

Hi, I'd like to draw with cairo over a surface of a GtkDrawingArea. My problem is that drawing over the surface doesn't draw a solid color over a color with alpha channel. I don't use any special cairo operators and the result is that I see some unneeded rectangles with alpha channel where there shouldn't be any.

cr = gdk_cairo_create(GTK_WIDGET(editor->drawing_area)->window);

cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_rectangle(cr, 0.0, 0.0, (double) widget->allocation.width, (double) widget->allocation.height);

/* do some other drawing */

/* draw with alpha channel */
cairo_set_source_rgba(cr, 0.25, 0.5, 1.0, 0.5);
cairo_rectangle(cr, (double) x, (double) y, (double) width, (double) height);

/* pop it to source */

Link to this post 05 Jun 11

I'm sorry. I've finally found the mistake. If you're interested in what went wrong you can look at revision 322

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Linux Training / Board