SDL and hardware alpha blits patch

Hi,

The attached SDL patch allows video backends to use hardware per pixel
alpha blits. (this patch fixes the problem described here :
http://www.libsdl.org/pipermail/sdl/2003-September/056557.html )

This patch adds a member to the SDL_VideoDevice structure. This new
member is of SDL_PixelFormat type and specifies the format for per pixel
alpha surfaces SDL should use when an hardware surface with alpha
channel is called (without it, the video format is used and the alpha
channel is sometimes lost).
This member should be filled during initialization by video backends
that can hardware accelerate per pixel alpha blits.

Stephane

PS : I’m cc’ing the DirectFB author (who’s also the author of the
DirectFB backend for SDL) because it’s the only backend able to do
hardware alpha blits for now (until the glSDL backend is done, of course :wink:

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: sdl_alphafix.patch
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20031023/1e7c1fc0/attachment.asc

Quoting Stephane Marchesin:

Hi,

The attached SDL patch allows video backends to use hardware per pixel
alpha blits. (this patch fixes the problem described here :
http://www.libsdl.org/pipermail/sdl/2003-September/056557.html )

Hi,

thanks for the patch. If you want to do alpha blending based on each
pixels alpha component you should replace DSBLIT_BLEND_COLORALPHA by
DSBLIT_BLEND_ALPHACHANNEL. The former flag is for constant alpha blending
using the alpha component set with surface->SetColor().–
Best regards,
Denis Oliver Kropp

.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"

                        Convergence GmbH

Hey Stephane, I’m considering this patch for SDL 1.2.7, and I don’t see
any backend that uses it. Did you have a corresponding patch to the DirectFB
backend?

David Olofson, does this patch work well with the glSDL backend?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Sam Lantinga wrote:

Hey Stephane, I’m considering this patch for SDL 1.2.7, and I don’t see
any backend that uses it. Did you have a corresponding patch to the DirectFB
backend?

No, there is no backend currently using it except the experimental glSDL
one which is in the works. IIRC if you want alpha channel support for
DirectFB you have to change some code as described here :
http://www.libsdl.org/pipermail/sdl/2003-October/057538.html
But I don’t have any video hardware supported by DirectFB so I can’t try :-/

Stephane

[…]

David Olofson, does this patch work well with the glSDL backend?

I think Stephane knows more about that ATM, as I haven’t been involved
with the backend version for a while.

Anyway, the patch was created for the glSDL backend in the first
place, since the SDL_DisplayFormat*() calls were doing the wrong
thing for glSDL. (OpenGL has no strict texture<->display pixel format
relation, so looking at the display pixel format makes no sense.)

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Sunday 04 January 2004 17.04, Sam Lantinga wrote:

No, there is no backend currently using it except the experimental glSDL
one which is in the works.

Okay, well I’ll hold off on that patch until the glSDL backend is ready,
or unless somebody contributes fully working DirectFB support.

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Okay, well I’ll hold off on that patch until the glSDL backend is ready,
or unless somebody contributes fully working DirectFB support.

I can’t currenlty write the DirectFB support myself,
but I could test it once it’s finished.

Thomas