Jump to content
  • Advertisement
Sign in to follow this  
LucasMeijer

Optimizing this image alpha clearing routine

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

Hey, I've got an image in memory, whose alphachannel I need to set to 0. The image is laid out like : RGBA, totalling 4 bytes for a pixel. I need to leave the RGB untouched, and set the A part to 0. There must be a very fast way to do this, but I surely haven't found it yet: Lets hope these code tags work: <code> unsigned char *imagePtr = getImagePtr(); unsigned int padding = 0; imagePtr+=3; for (row=0;row!=myImageInfo.iHeight;row++) { for (column=0;column!= myImageInfo.iWidth;column++) { *imagePtr = 0; imagePtr+=4; } imagePtr += padding; } </code> Does anybody know where to find info on how to optimize these relativly lowlevel functions? Or a specific tip for this situation? Thanks, Lucas

Share this post


Link to post
Share on other sites
Advertisement
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!