Re: drawing on offscreen surface



This code is quite strange. Your call to cairo_set_source_surface() is
not useful since you use cairo_set_source_rgb() just after. You should
call cairo_paint() just after cairo_set_source_surface() if you want it
to have any effect.

Hope it helps,
Jean

Le vendredi 10 août 2012 à 13:07 +0530, Prasanta Sadhukhan a écrit :
> expose_event (GtkWidget *widget,GdkEventExpose *event, gpointer
> data)
> {
>   g_print("draw event main\n");
> 
>   cairo_t *cr = gdk_cairo_create(widget->window);
> // draw blue rectangle into offscreen
>   cairo_set_source_surface(cr, surface, 0, 0);
>   cairo_set_source_rgb(cr, 0, 0, 1);
>   cairo_rectangle(cr, 300, 300, 200, 200);
>   cairo_stroke(cr);
>   cairo_paint(cr);
> 
> //draw green rectangle onto main window
>     cairo_set_source_rgb(cr, 0, 1, 0);
>   cairo_rectangle(cr, 100, 100, 200, 200);
>    cairo_stroke(cr)
> }
> 
>         
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]