Re: Alpha blending between DrawingArea and HBox





On 07/20/2009 03:43 PM, David Lucena wrote:
Hi. I'm pretty much new to gtk. I've been about two days trying to draw a
transparent widget over another. I am using a HBox layout widget actually
where I put a DrawingArea, and use cairo to fill with a transparent red
color (50% alpha).

I've got the colormap of the Screen, and applied to the DrawingArea and
the HBox. The HBox is inside a GtkWindow with the background painted with
green using also cairo contex. The more transparency I give to the red
color of the DrawingArea, the more white it appears, but I wanted that it
blended with the green color. I have tried to do this avoiding the HBox,
and putting the DrawingArea directly to the GtKwindow, but also does not
work.

BUT! If I set the colormap of the Screen to the GtkWindow, the more
transparent y make the red color of the DrawingArea, the more I see my
desktop Background, but I want to see just the red color blended with the
GtkWindow green color.

I also have tried to paint the HBox in green, but the expose-event for the
box never gets called.

I don't know If what I want to do is possible. My brains tells me it OUGHT to be possible, but I don't know 
if I have to use a X11 approach or another hack like getting the window background and then paint it to the 
DrawingArea and then drawing everything else.

Thanks in advance for your help.

By the way, I am using PyGTK, but I am sure this issue is not cause by
a binding bug.


I believe your problem my be that only widgets that have their own GdkWindow can be composited. If memory serves, the only widgets that have their own GdkWindow are GtkWindow, GtkEventBox, and GtkDrawingArea.




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