Results 1 to 4 of 4

Thread: Only Black works as Transparent color

  1. #1

    Only Black works as Transparent color

    I have the following code to set the TransparentColor of an image :

    Code:
            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?

  2. #2

    Only Black works as Transparent color

    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.

  3. #3

    Only Black works as Transparent color

    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

  4. #4

    Only Black works as Transparent color

    Thanks for your answers.
    So there is no way to do this in my procedure?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •