Re: Pixmaps & transparency



Peter Zhelezniakov wrote:

Hello GTK developers,

I have an external library that draws possibly transparent/translucent images to a GdkDrawable only. I want to capture these images in a pixbuf, but when i try to copy pixels from the drawable (a pixmap), all information about transparency is lost.

GdkPixmap is essentially a wrapper around X Pixmaps. You won't be able to keep transparency info in an X Pixmap unless you're using X.org 6.8.x (and I believe you need the composite extension enabled to get the required ARGB visual). Then you need to create the Pixmap (or GdkPixmap) using the correct 32-bit ARGB visual that supports transparency.

I suppose you could subclass GdkPixmap to add some private fields to somehow keep track of transparency data (a mask, probably), regardless of what visual the backing Pixmap uses. I'm not sure that this would get you exactly what you want. Likely you'd be much better off using GdkPixbuf to hang on to image data with transparency. The downside, of course, is that GdkPixbufs are stored client-side rather than server-side like Pixmaps are, so you might suffer a performance hit depending on what you're doing.

   -brian



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