[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    Re: Transparent Color in blitting with X11
From:       Glynn Clements <glynn () gclements ! plus ! com>
Date:       2010-07-29 10:42:22
Message-ID: 19537.23310.930934.654879 () cerise ! gclements ! plus ! com
[Download RAW message or body]


Peter Harris 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.

Alternatively, you can do it in two steps:

	XSetFunction(dpy, gc, GXandInverted);
	XSetBackground(dpy, gc, 0UL);
	XSetForeground(dpy, gc, ~0UL);
	XCopyPlane(dpy, mask, win, gc, ..., 1UL);
	
	XSetFunction(dpy, gc, GXor);
	XCopyArea(dpy, image, win, gc, ...);

The image must have all background (transparent) pixels set to zero.

Also, you can use XPutImage() instead of XCopyPlane() and XCopyArea().

-- 
Glynn Clements <glynn@gclements.plus.com>
_______________________________________________
xorg@lists.freedesktop.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: freedesktop-xorg@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic