Getting crazy over transparency

Glynn Clements glynn at gclements.plus.com
Mon Aug 2 12:40:19 PDT 2010


Rashid wrote:

> I dont know why,
> 
> but im to stupid to blitting transparent images with xlib. DAMN, with
> SDL was ist quite easy. Dont know if someone want to help me, but im
> trying it since days and getting mad over time... 
> 
> Can someone have a quick look, why it isnt working? skullmask.xpm is a 1
> bit image. Use ./built für building (make is for cross compiling). 
> 
> The whole stuff is in the zip archive. I would be realy happy someone
> would help me.
> 
> Error Message:

> X Error of failed request:  BadMatch (invalid parameter attributes)
>   Major opcode of failed request:  56 (X_ChangeGC)
>   Serial number of failed request:  50
>   Current serial number in output stream:  1404

> 	if (XpmReadFileToPixmap (mainwindow->display, mainwindow->window,
> "skullmask.xpm", &skullImage.clipmask, &maskshade, NULL)) 

You have the parameters backwards; the pixmap comes before the mask. 
Consequently, skullImage.clipmask contains the pixmap, while maskshade
contains the mask.

That causes this:

	XSetClipMask(mainwindow->display, mainwindow->gc, skullImage.clipmask);

to fail, as the clip mask isn't a bitmap (1-bit per pixel).

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list