Page 1 of 1

How to control matte / AND mask for Windows icons?

Posted: 2013-03-26T05:56:29-07:00
by eyebex
I'm trying to write an 8-bit Windows icon whose pixels are fully transparent if the corresponding pixel in the 32-bit RGBA source image is fully transparent. I realize that transparency in 8-bit Windows icons is not handled by defining one of the 256 colors to be treated as transparent (like e.g. the GIF format does) but by a matte / AND mask that is stored in addition to the pixel data. While from looking at icon.c it seems it is able to write the mask, I did not yet succeed to call convert in a way that for a source alpha value == 0 a mask value of 0x00 is written, and for a source alpha value != 0 a mask value of 0xff is written. Any hints on how to do that?

PS: Back in this thread I was still thinking that Windows icon transparency is achieved by palette index transparency, which is wrong, see above.