Jump to content
  • Advertisement
Sign in to follow this  
MPV

How can i get pixel colour?

This topic is 4853 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I'm trying to do some simple programs in DirectX and I want some parts of an image become transparent (I'm reading "Beginning DirectX 9" by Wendy Jones and I've started using the colour key in the help function D3DXLoadSurfaceFromFile, but it didn't become transparent!), so I want to get the pixel colour in order to compare it. After the comparation, I'm tkinking of using the function StretchRect for each pixel! The only problem is that I don't know how to get each pixel colour from a surface or the screen! Please someone tell me how to do it! Tkanks! =P

Share this post


Link to post
Share on other sites
Advertisement
I had that book, and I remember I couldn't get that to work either. Don't do the sprites they way she does in that book. Use the ID3DXSprite interface. What you are looking for is alpha blending, which is a flag you can pass to the begin method of the sprite interface. Also, a tip for the later chapters. She tends to skip important sections in chapters, so sometimes you have to look into the next chapter to see what you actually need to get the examples to work. I had a ton of problems with that book. If I recall, she forgot to mention to turn on the lights and set the materials once.

Share this post


Link to post
Share on other sites
Tkanks for info! I'll try use that, but I still want to know how to get each pixel colour from a surfacem, so if someone knows plase tell me!

Share this post


Link to post
Share on other sites
Quote:
Original post by MPV
Tkanks for info! I'll try use that, but I still want to know how to get each pixel colour from a surfacem, so if someone knows plase tell me!

Check out this KBase article. However, this definetly not the best approach to the problem. The solution should lie with either fixing the alpha blending stuff or fixing your source art.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!