Re: extracting a portion of a GdkPixmap



On 8/9/05, Boncek, John <jboncek hunter com> 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.

I think you just make a new small pixmap of the size you need, then
copy the pixels you want from your big pixmap into the small pixmap.
The copy will (usually) be done in hardware, so it's very fast.

You could consider using a pixbuf instead and doing the manipluation
on the client side, but perhaps that doesn't suit your application. If
it does, there's a very convenient pixbuf constructor:

http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-creating.html#gdk-pixbuf-new-subpixbuf

John



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