Jump to content
  • Advertisement
Sign in to follow this  
kev000

SDL image brightening function help

This topic is 3922 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 I've got this function that brightens, pixel-by-pixel a surface for mouseover/click events. When I get to the very last pixel in the surface, it crashes. I don't even know if I'm doing it correctly. Can anyone help? Here is the function in question: http://linuxice.pastebin.com/m38f4f700 thanks

Share this post


Link to post
Share on other sites
Advertisement
If you want reasonable performance, it's best to lighten your images offline. Writing to individual pixels in software is far from optimal.

You should probably move those std::cout lines so that you can find exactly which line it crashes on! I assume the setpixel/getpixel examples are the ones from the SDL documentation? Do they take surface pitch into account?

Share this post


Link to post
Share on other sites
I think that faster method is drawing another white surface on your actual one and changing alpha component each time only..

btw.. your code looks ok..

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!