Problem with png and alpha blending

I try to use png-images with alpha-channel, but all I get is a non-masked
image with some mess in it. When creating a surface, according to
documentation, SDL_SRCALPHA-flag is set if the image has an alpha-channel?
Ok. If I create the image to HW_SURFACE, does alpha-blending work because
SDL doesn’t support HW-accelerated alpha-blending? If the problem is
because of this, what should I do? Which buffers should I translate into
SW-buffers to make the blending work correctly. Or could this be because
of the png-format and IMG_Load-malfunction… or something…?

Make sure you’re using SDL_DisplayFormatAlpha(); not SDL_DisplayFormat().

If you don’t use SDL_DisplayFormat() at all, then 1) I don’t know what’s
going on, and 2) you really should use SDL_DisplayFormatAlpha! :slight_smile:

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Sunday 03 February 2002 01:56, Juhana Lehtiniemi wrote:

I try to use png-images with alpha-channel, but all I get is a
non-masked image with some mess in it. When creating a surface,
according to documentation, SDL_SRCALPHA-flag is set if the image has
an alpha-channel? Ok. If I create the image to HW_SURFACE, does
alpha-blending work because SDL doesn’t support HW-accelerated
alpha-blending? If the problem is because of this, what should I do?
Which buffers should I translate into SW-buffers to make the blending
work correctly. Or could this be because of the png-format and
IMG_Load-malfunction… or something…?