[SDL] Loading bitmaps with transparency? (Torsten Giebl)

Patricia Curtis patricia.curtis at gmail.com
Sun Mar 4 00:30:42 PST 2007


Its simple to use transparency just save your images as a PNG-24 which will
give you 255 levels of transparency and you don't have to do the colour
keying either.

SDL_Surface * gLoadedImage = SDL_DisplayFormatAlpha(IMG_Load("SomePNG.png"
));

i use it for my sprites, i anti alias the edges and save png in photo shop,
save for web is best for reducing the size of images. then when i blit them
i use.

SDL_BlitSurface(gLoadedImage , &SrcRect ,gScreen , &DestRect);

And just to make this complete i create my screen with

gScreen = SDL_SetVideoMode(ScreenWidth, ScreenHeight, 32, SDL_HWSURFACE |
SDL_FULLSCREEN | SDL_DOUBLEBUF | SDL_ANYFORMAT);

So PNG image Blitted to screen transparent with anti alias edges.
yeah everyone else i know this is basic simple stuff but hey just trying to
take part in the group.

Have fun

Trish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070304/0c36d372/attachment.htm 


More information about the SDL mailing list