Jump to content
  • Advertisement
Sign in to follow this  
ScottC

SDL image help?

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

How would I go about setting transparency on visible images, and resizing them. Such as setting amounts of R, G, B, and Alpha.

Share this post


Link to post
Share on other sites
Advertisement
For resizing you can use a library like SDL_gfx. For setting the alpha for an entire image you can use SDL_SetAlpha. For setting per-pixel data you can directly access the pixels member of the SDL_Surface.

Share this post


Link to post
Share on other sites
Say i want to remove 0,0,255 color from the image completely, so I make area's I don't want to show blue, how can I do that?

Share this post


Link to post
Share on other sites
Quote:
Original post by Peregrin
Quote:
Original post by ScottC
Say i want to remove 0,0,255 color from the image completely, so I make area's I don't want to show blue, how can I do that?

SDL_SetColorKey.


Here's an example of your code:

// Already loaded before hand and optimized with SDL_DisplayFormat
SDL_Surface* myLoadedImage;

// Now we set the color key by mapping the color we want
SDL_SetColorKey( myLoadedImage, SDL_SRCCOLORKEY, SDL_MapRGB(myLoadedImage->format, 0, 0, 255 ) );



That's all there is to it!

Share this post


Link to post
Share on other sites
Quote:
Original post by ScottC
Say i want to remove 0,0,255 color from the image completely, so I make area's I don't want to show blue, how can I do that?


I have a tutorial that covers that.

Lazy Foo's SDL tutorials

[Edited by - Lazy Foo on August 9, 2007 7:27:13 PM]

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!