PDA

View Full Version : Only Black works as Transparent color



Nightmare_82
18-07-2003, 05:40 PM
I have the following code to set the TransparentColor of an image :



if p_bTransparent then
begin
m_oImageList.Images[Result].TransparentColor:= m_oImageList.Images[Result].Pixels[0,0,0];
end;


But it only works with images that have the transparent color black.
Can you give me an example how to do this with other colors without the VTD-Tool?

Runner
21-07-2003, 09:33 AM
I haven't actualy tried, but the problem might be in .Pixels[0,0,0]. Maybe you should try wth the Hex number instead. Like $FF9F0000. Just guesing though. :? Try it and see if it works.

if p_bTransparent then
begin
m_oImageList.Images[Result].TransparentColor:= $FF9F0000
end;

It should work for any color.

jansoft
28-07-2003, 11:29 AM
I don't know how property TransparentColor of ImageList works, but in VTDManager Transparent color is "translated" into alpha chanel by checking source image pixel's colors, e.g.:
for each pixel do
if (pixel and $FFFFFF) = trcolor then
pixel:= pixel and $FFFFFF //set alpha chanel to 0 - transparent
else
pixel:= (pixel and $FFFFFF) or $FF000000; //set alpha to 255 - opaque

Nightmare_82
06-08-2003, 09:12 PM
Thanks for your answers.
So there is no way to do this in my procedure?