Simple Composite app?

Carl Worth cworth at cworth.org
Wed Nov 17 13:21:46 PST 2004


On Thu, 02 Sep 2004 14:38:13 +1000, Chris Debenham wrote:
> Does anyone have a very simple app that uses the new ARGB visual to make a
> window with some bits transparent?

Hi Chris,

I had been meaning to play with ARGB visuals this myself for quite some
time and I thought your email would provide a nice exercise. Only now did
I finally get around to it though.

> Basically I just want to:
> * Create a window
> * Make it transparent
> * draw a opaque box on it
> * draw a translucent box on it

I wrote an Xlib-only program (argb_demo) to do just that and just sent
it to the list in the "creating true transparent widgets" thread.

> Can this be done with pure xlib or do I also need cairo etc?

As demonstrated above, Xlib is sufficient for doing it, but my example
is really, really simple, (non-overlapping rectangles of uniform color).

Drawing anything significantly more interesting, (overlapping composited
shapes, antialiased curves, etc.), means computing the right pixel
values on the client side. And Xlib won't help much.

This is where cairo comes in---it makes this task much easier.

Here's another program that is a variation of argb_demo. It replaces the
Xlib-based draw function with something cairo-based that also
demonstrates how to use different compositing operators, and how to draw
arcs and splines.

I hope you find this useful.

-Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: argb_cairo.c
Type: text/x-c
Size: 5577 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20041117/093e99f6/attachment.bin>


More information about the xorg mailing list