locked
Color Transparency using BitBlt RRS feed

  • Question

  • Hi,

    For color transparency, Windows provides TransparentBlt call which will not draw the color specified, but in some blogs I read that the same can be done by using BitBlt calls. Does someone have any sample code which can show how to make color Transparency using BitBlt call.

    For example, I have an image with magenta colors and I want that when the image is blitted onto the screen the magenta colors should not be displayed.

    Regards,
    CED
    Friday, March 5, 2010 7:48 AM

Answers

All replies

  • I think the only GDI function that provides for transparent BLTing is TransparentBlt(). None of the ROP codes which are supported by BitBlt() have the transparency flag.

    On a related note, if you wanna use DirectDraw to get the same task done, I have a post below:
    Transparent Blitting using DirectDraw


    -Prabhu
    www.geekswithblogs.net/techtwaddle
    Friday, March 5, 2010 12:53 PM
  • yah with that prabhuk link you can achive the transparent color and also there is a easy way that you can added the custom color to you'r control. 
    custom color nothing but you'r controls parent control take the parent control RGB value directly control will not accept the custom color you need to give the RGB numbers for you'r solid brush then it will accept.
    like
    System.Drawing.Color alternativeColor = System.Drawing.Color.FromArgb(210, 127, 33);
    you'r control background color = alternativeColor.
    Friday, March 5, 2010 1:08 PM
  • Hi,

    I have to use GDI to get that effect. Currently I am using TransparentBlt call itself, but in some blogs I read that TransparentBlt call has a know memory leak issue but not sure whether it is also applicable to Windows Mobile 6.5.

    Thanks for the DD link but I have to use GDI only. I can do translucent image display using BitBlt call but am not sure how to do for color transparency but am positive that it can be done. I have seen one such in codeproject but could not get anything out of the code.

    Regards,
    CED
    Friday, March 5, 2010 3:11 PM
    • Marked as answer by warrentang Thursday, March 11, 2010 3:00 AM
    Tuesday, March 9, 2010 1:22 AM