Skip to main content
gamedev.net
🔒 Locked

SDL image help?

Started by ScottC 4 replies 1k views
Original Post
ScottC
ScottC
How would I go about setting transparency on visible images, and resizing them. Such as setting amounts of R, G, B, and Alpha.
SiCrane
SiCrane
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.
ScottC
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?
Drew_Benton
Drew_Benton
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_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!
Lazy Foo
Lazy Foo
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]
Learn to make games with my SDL 2 Tutorials

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.