Jump to content
  • Advertisement
Sign in to follow this  
petelta

SDL color keying

This topic is 4286 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

Im doing the Lazy Foo tutorials right now and am doing the color keying. I am wondering where I can find the color codes so that I can make the background colors be transperant. On the tutorial, it has: Uint32 colorkey = SDL_MapRGB( optimizedImage->format, 0, 0xFF, 0xFF ); and that is for a light blue background. I have a few images with other colors I would like to use.

Share this post


Link to post
Share on other sites
Advertisement
The last three parameters of SDL_MapRGB are values for red, green, and blue colour components respectively. In the example you gave these values are entered in hexadecimal (decimal equivalent 0,255,255), meaning no red, full green, and full blue components, giving a cyan colour.

You can enter the codes as integers from 0-255 for each one. Many image programs, such as photoshop will show the codes for you to use. Even MSPaint does, just select your colour from the image, click on

"colours" -> "edit colours" -> "add to custom colours"

in the menu and the codes will be shown under the red, green and blue headings in the bottom right.

Hope that helps =]

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!