I've tried doing something like this for all the pixels:
*pixel = SDL_MapRGBA(image->format, r, g, b, a);
Changing the value for "a" in the call to SDL_MapRGBA() works as expected on PNG files without transparency, but if the image has transparency, I instead end up with this:
Here, "a" was set to 255. Changing the alpha still works (changes the opacity), but it's like all the pixels have been replaced by black ones, except for the 40 lines of pixels at the top, which are white.
Any idea what's going on?