Sign in to follow this  
Robinhood

How to Display PNG Files with Alpha Channel?

Recommended Posts

Robinhood    122
Here is my code: CImage img; //Constructor img.Load("Test.png"); //OnDraw img.AlphaBlend(pDC,0,0,width,height,0,0,width,height); the code above doesn't display PNG very well, and there is some mess in the picture. Someone help me!

Share this post


Link to post
Share on other sites
Kalidor    1087
It's pretty hard to tell what's wrong without seeing the code for CImage::Load and CImage::AlphaBlend, and it's hard to understand what's wrong from the description that it doesn't display it very well and with some mess. It would help if you could post some screenshots of the problem. Also post the code for your load and alphablend functions, and tell us what the alphablend functon's supposed to do. If CImage is a class from some image loading library then tell us which one as well.

PS: When you post your code, put [ source ][ /source ] tags around it (without the spaces inside the brackets) to make it more readable.

Share this post


Link to post
Share on other sites
Wudan    211
When you load the picture, are you certain you are getting the alpha channel, or that one exists in the picture you're using? Tons of test pictures for different types of png images are available at the libpng website, http://www.libpng.org/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this