Re: Gtk2 to Gtk3 question - how to use cairo_surface_t



On Fri, May 18, 2012 at 1:49 PM, Collin Day <dcday137 gmail com> wrote:
> Hi all,
>
> I am converting some code from gtk2 to gtk3.  I understand that GdkPixmap is
> replaced by cairo_surface_t.  Acroos the code I am changing, I have a lot of
> situations like:
>
>     GdkPixmap *map;
>     gtk_image_get_pixmap( GTK_IMAGE(widget), &map, NULL );
>
> .....
> draw stuff on map
> .....

What kinds of things are you drawing on 'map'? If it's stuff like
circles and lines, or other pixmaps, you know, any sort of basic
vector graphics or image compositing, you probably want to replace the
entire thing with a GtkDrawingArea that uses the cairo drawing API
natively.

> What I can't seem to figure out from the documentation is how to replace the
> gtk_image_get_pixmap() function.  Would you just use a GdkPixbuf and
> gtk_image_get_pixbuf() - if so, I can't seem to figure how to go from the
> pixbuf to the cairo_surface_t.  You can just set the cairo context to use
> the pixbuf directly with gdk_cairo_set_source_pixbuf(), but I am not sure if
> this is the best/right way.
>
> Sorry for the noobish question, but that is what I am to gtk.
>
> Thanks for your time!
>
> -C
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>



-- 
  Jasper


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