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. So far i can think of two ways to solve this:

- Draw every image to two pixmaps with different backgrounds, then compare results - Extend GdkPixmap somehow (isn't Gdk an object system, after all?) and override painting methods so that they keep track of transparency. I'm not sure this is feasible however.

Could anyone please comment on this, or come up with better ideas?

    If your external library uses gdk_draw_pixbuf () to draw to the
said drawables, you could hold a reference to the passed pixbuf by
overriding the GdkPixmap implementation of "->draw_pixbuf()" in your
GdkPixmap derivative, it doesn't sound elegant but if your stuck with
that functionality; it'll do the trick.

Cheers,
                                   -Tristan




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