The correct method to create a invisible (blitable-base) surface

Hello.

This is the sequence I need to do:

1 - Create a 100% transparent ( invisible ) surface;
2 - Blit a surface loaded with PNG on it;
3 - Blit the result to screen.

Untill now, or my blitted surface have a 100% black background OR the resultant
surface gets totally invisible.

I found a previous post about this subject, but it’s not the absolute same
thing, and it was not answered.

Thank you.

Miguel

SDL_BlitSurface is acting exactly as intended. If you’re doing an RGBA->RGBA blit from any surface onto a completely transparent surface, then you need to use SDL_SetAlpha to remove the SDL_SRCALPHA flag from your source surface. If you want the transparent parts to still shine through, then you have to use SDL_SetColorKey (SDL_SRCCOLORKEY flag) on your source surface. If you don’t do these things, you’ll end up either blitting nothing or blitting exactly what you had on the source surface. If you want more alpha-blending options, then look into OpenGL, DirectX, or Sprig (for software).
http://pubpages.unh.edu/~jmb97/SPriG.html

Jonny D> To: sdl at libsdl.org

From: pragier at gmail.com
Date: Mon, 28 Jul 2008 22:03:59 +0000
Subject: [SDL] The correct method to create a invisible (blitable-base) surface

Hello.

This is the sequence I need to do:

1 - Create a 100% transparent ( invisible ) surface;
2 - Blit a surface loaded with PNG on it;
3 - Blit the result to screen.

Untill now, or my blitted surface have a 100% black background OR the resultant
surface gets totally invisible.

I found a previous post about this subject, but it’s not the absolute same
thing, and it was not answered.

Thank you.

Miguel


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org