Re: Using existing cairo context for GtkDrawingArea
- From: Ivan Baldo <ibaldo adinet com uy>
- To: asubedi <asubedi gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Using existing cairo context for GtkDrawingArea
- Date: Fri, 08 Dec 2006 14:17:03 -0200
Hello.
You can't AFAIK.
GTK is double buffered, for every expose event, it draws to a
different place. When you draw on the expose event, you are not drawing
into the visible area of the screen, when the expose event is finished,
GTK switches the drawing you just did offscreen to appear on the screen
instead of the old one.
So you must create a new Cairo context for every expose event, but
don't worry, this is highly optimized and no time is wasted on the new
context for every expose event.
If you are having performance problems, you may try to use a cache
for some parts of your drawing, you can use the
cairo_surface_create_similar function for that, you can create a Cairo
context for that surface and draw things there, then you can use that
surface on the Cairo context of the expose event. You can cache mostly
static things and the more dynamic ones you can draw in the expose event.
HTH, goodbye.
El 07/12/06 20:37, asubedi escribió:
Hi,
I am trying to create a Graph widget using Cairo. I am using Ruby, but
you can reply in any language you prefer.
In the examples I have seen about using cairo in gtk application, most
create a cairo context from GtkDrawingArea in the handler of expose
event. However, I would like to create a cairo context independent of
GtkDrawingArea, and would like to use that context in GtkDrawingArea's
expose handler. How can I do that?
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
Ivan Baldo - ibaldo adinet com uy - http://ibaldo.codigolibre.net/
ICQ 10215364 - Phone/FAX (598) (2) 613 3223.
Caldas 1781, Malvin, Montevideo, Uruguay, South America.
We believe that we are free, but in reality we are not! Are we?
Alternatives: ibaldo codigolibre net - http://go.to/ibaldo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]