Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the pixel array containing the RGBA (RGB and Alpha) values consequently. I want to apply the alpha value for each pixel. For that I am using BITMAPV4HEADER and 'SetDIBitsToDevice' function to draw the pixel array into picture box. But the Alpha value is not working (RGB is working fine). How can i use alpha value??

I am tried with AlphaBlend function, but it always apply the transparency to all pixels. I want apply for each pixel with different alpha value by using(SetDIBitsToDevice).
Posted
Comments
Matthew Faithfull 3-Jun-13 8:56am    
I can't find anything in the documentation for SetDIBitsToDevice that indicates it uses alpha values. What makes you think this should work?

As already noted in a reply to your previous question, GDI functions like SetDIBitsToDevice will clear the alpha values of the bitmap. See Alpha Blending a Bitmap[^] in the MSDN on how to use the AlphaBlend function with source alpha values.
 
Share this answer
 
The documentation of AlphaBlend says to set bSrcAlpha to 255 to use the per-pixel alpha values. Have you done that?
 
Share this answer
 
Comments
Rajeshkumar Ramasamy 5-Jun-13 7:11am    
I got it :-)
nv3 5-Jun-13 7:37am    
You are welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900