Thanks to those who replied.  gdk_draw_drawable is working.  I know you
have to unref certain kinds of objects.  Do you have to unref a GdkPixmap
when finished with it?

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian J.
Tarricone
Sent: Tuesday, August 09, 2005 3:15 PM
Cc: gtk-app-devel-list@gnome.org
Subject: Re: extracting a portion of a GdkPixmap

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Boncek, John wrote:
> I have a GdkPixmap.  I need to programmatically extract a new GdkPixmap
> from this image based on x- and y-coordinates, plus width and height.
The
> x, y, width, and height parameters will vary too much at runtime to
store
> all the copies needed.  Conceptually this seems simple.  But from among
> the enormous number of different image formats and image-manipulation
> functions in GTK/GDK, I can't find a way to do it, after a *lot* of
> searching.

If you just need to copy a region of a GdkPixmap into another GdkPixmap,
you can use gdk_draw_drawable():
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Drawing-Primitives.html#gdk
-draw-drawable
Note that you need to create the destination GdkPixmap first, via
gdk_pixmap_new().

If you want to copy a region of a GdkPixmap to a client-side GdkPixbuf,
use gdk_pixbuf_get_from_drawable():
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Pixbufs.html#gdk-pixbuf-get
-from-drawable

        -brian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFC+Q7c6XyW6VEeAnsRAozhAJ48uuC/WHDB8NZnikarN4ve9OP9xACfXHcd
e5rRRdz+qccNeAEha58z2Dg=
=dpDM
-----END PGP SIGNATURE-----
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to