Modifying testalpha for use with transparent PNG/TIF?

Hi everyone,

I need to use full 32 bit RGBA images in my application in order to
achieve the smoothest possible alpha blending (simply colorkeying, as
transparent GIFs do, isn’t good enough–full 8 bit alpha is necessary).

I was hoping to get the testalpha demo working with a test PNG I created,
whose alpha channel is a grayscale gradient (so that the resulting image
has a wide range of smoothly changing tranparency values).

By linking testalpha with the SDL_image lib, testalpha loads the
PNG. But, the
transparent areas of the PNG, instead of allowing the background to
show through, appear black. It is as if there were an opaque black
backing behind my PNG, and anywhere the PNG is transparent, this backing
shows through instead of the actual background (where the PNG is opaque,
everything looks as it should, since both the “backing” and the background
are hidden by the PNG itself)

Of course, as the testalpha program does
its alpha cycling, the entire PNG properly fades out, revealing the
background as it should, and then fades in again. So, the alpha
code works as it should; it’s just that the alpha channel in my PNG
isn’t interpreted correctly.

What do I need to do to force SDL to properly interpret alpha for
all surfaces?

Thanks for any suggestions,

Steve Madsen
H2Eye Ltd
24-28 Hatton Wall
London EC1N 8JH
Tel:+44 (0) 207 404 9600
Fax: +44 (0) 207 404 9490
Email: @Steve_Madsen

What do I need to do to force SDL to properly interpret alpha for
all surfaces?

It’s probably a bug.
If you send me a simple sample I can look at it when I get some time.

See ya,
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec