Jump to content
  • Advertisement
Sign in to follow this  
Kitasia

Changing hue

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

Does anyone know a good technique to change the hue of images or certain colors on the image? Would I have to use an entirely new image just for a couple of color changes? EDIT: Oh and I'm also using SDL!

Share this post


Link to post
Share on other sites
Advertisement
Using a different image for each Hue is probably the easiest way. To change the "Hue" as HSL (Hue/Luminance/Saturation) you'd have to traverse your sprite pixel by pixel; read a pixel, at least for its L and S values, and then convert the new Hue along with the luminance and saturation back into RGB values. This would be rather slow so you certainly wouldn't want to do it each frame.

Share this post


Link to post
Share on other sites
I thought that would be a problem. I guess all the old game used seperate colors too. Oh well! A few more files can't hurt much! Thanks!

Share this post


Link to post
Share on other sites
Some old games used palette colors. Each pixel was not a color value but an index to a table of colors. All the programmer had to do was change one color in the palette and it would change all the pixels of that color to whatever other color was needed. Now each pixel has an explicit RGB value.

By the way, I guess you can avoid the computation for changing a pixel's hue if you pre-compute it and store it in an array or something. Then instead of computing the new colors you could just search and replace.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!