SDL color keying

Started by
1 comment, last by petelta 17 years, 2 months ago
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.
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 =]
alright, thanks. That makes sense.

This topic is closed to new replies.

Advertisement