[cairo] problems with surfaces
Ricardo Markiewicz
rmarkiewicz at assekuransa.com
Wed Aug 25 09:33:02 PDT 2004
Hi all! ... this is my first post in this list and i hope that can help
me :-P (and can understant my english :-D)
i'm writing an example of Cairo to draw in a GtkWidget, but instead of
write directly over the GdkWindows, first i want to draw over surfaces
and then "paste" thats surfaces over the GdkWindow. I need this (if i
can do it work) for develop a custom widget for an app.
In C code what i'm doing is :
w = h =100
== On start up ==
cr = cairo_create ();
cairo_set_target_surface (cr, surface);
cairo_save (cr);
cairo_set_rgb_color (cr, 255, 0, 0);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
cairo_stroke (cr);
cairo_set_rgb_color (cr, 0, 0, 0);
cairo_rectangle (cr, 0, 0, w, h);
cairo_stroke (cr);
cairo_restore (cr);
cairo_destroy(cr);
(this draw a red box with black border)
Then, in the expose event of the GtkWidget :
cr = cairo_create ();
cairo_gdk (cr, window);
cairo_save (cr);
cairo_move_to (cr, 10, 10);
cairo_show_surface (cr, surface, w, h);
cairo_stroke (cr);
cairo_restore (cr);
cairo_destroy(cr);
But, what i can see is not what i want (see attachment). If i change the
second rectangle to :
cairo_rectangle (cr, 10, 10, w-10, h-10);
this work , but has no sence !. I's like the second call is relative tu
the window instead of que surface.
thanks!
--
Ricardo Markiewicz
Sistemas
ASSEKURANSA
Tel:(5411) 4327-7234 Int:114
Fax:(5411) 4327-4447
www.assekuransa.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.jpg
Type: image/jpeg
Size: 1873 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040825/08ac7b3c/test.jpg
More information about the cairo
mailing list