Transparent Color in blitting with X11

Peter Harris pharris at opentext.com
Wed Jul 28 08:14:19 PDT 2010


On 2010-07-28 05:44, Rashid wrote:
> but xlib doesnt support an alpha channel (and the freerunner has only 16
> bits per pixel). is there an easy way to do transparency (one
> transparent color is enough) with xlib or a toolkit which builds on it?

If you can easily extract that color into a 1-bit bitmap, you can use
XSetClipMask.

Many GPUs accelerate the RENDER extension, so you can use XRenderCompose
instead of XCopyArea to gain an alpha channel. (I'm not familiar with
your particular GPU).

If you want something higher level than Xlib, I hear good things about
Cairo - http://cairographics.org/ - but I haven't used it myself.

> Btw. im doing the double buffering in a very stupid way.
> 
> I write everything to a buffer and then copy the buffer to a window. Is
> there a faster and more clever way?

No. You just have to be careful; if your toolkit already does double
buffering, you'll wind up triple buffering.

Peter Harris
-- 
               Open Text Connectivity Solutions Group
Peter Harris                    http://connectivity.opentext.com/
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866



More information about the xorg mailing list