SDL image help?
How would I go about setting transparency on visible images, and resizing them. Such as setting amounts of R, G, B, and Alpha.
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.
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?
Quote:Original post by PeregrinQuote: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_DisplayFormatSDL_Surface* myLoadedImage;// Now we set the color key by mapping the color we wantSDL_SetColorKey( myLoadedImage, SDL_SRCCOLORKEY, SDL_MapRGB(myLoadedImage->format, 0, 0, 255 ) );
That's all there is to it!
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement