Hi Ivan and Iago, Thanx for the tips and the explanations. I will study Cairo and try to draw with Cairo. --- Asela.
On Tue, 18 Jul 2006 19:04:38 +0200 Iago Rubio <[EMAIL PROTECTED]> wrote: > Hi Asela, > > On Tue, 2006-07-11 at 11:45 +0900, Asela Leelaratne wrote: > > Hello List members, > [snip] > > The problem is I need to do some raster operations like ROP2, ROP3, > > Porter and Duff etc... Are there any api's in Gtk(or Gdk) to achive it? > > If not is there a library or something that I can use(C language)? > > If both the above is not possible is there a standard method to do the > > above operations(C language, GDK and Gtk widgets)? > > There is support for Porter/Duff operations in cairo. Check the cairo > documentation on cairo_operator_t . > > It supports all 12 Porter/Duff operations plus 'add' and 'saturate'. > > typedef enum _cairo_operator { > CAIRO_OPERATOR_CLEAR, > CAIRO_OPERATOR_SOURCE, > CAIRO_OPERATOR_OVER, > CAIRO_OPERATOR_IN, > CAIRO_OPERATOR_OUT, > CAIRO_OPERATOR_ATOP, > CAIRO_OPERATOR_DEST, > CAIRO_OPERATOR_DEST_OVER, > CAIRO_OPERATOR_DEST_IN, > CAIRO_OPERATOR_DEST_OUT, > CAIRO_OPERATOR_DEST_ATOP, > CAIRO_OPERATOR_XOR, > > CAIRO_OPERATOR_ADD, > CAIRO_OPERATOR_SATURATE > } cairo_operator_t; > > You just need to set the operator with cairo_set_operator(cairo_t, > cairo_operator_t) and it will be used on subsequent drawing operators. > > To pick the cairo context from a GdkDrawable you may use > cairo_t* gdk_cairo_create (GdkDrawable *drawable); > > Once you aquired the cairo context, you can start to use the cairo API > on it. > > // ... > cairo_t ct; > GtkWidget* widget; > > widget = gtk_drawing_area_new(); > ct = gdk_cairo_create (widget->window); > cairo_set_operator(ct, CAIRO_OPERATOR_DEST_OVER); > // ... > > This is available as for GTK+2.8. > -- > Iago Rubio > > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list 以上、よろしくお願いいたします。 ------------------------------- Asela Leelaratne _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list