#15762·SDL

Strange behavior of SDL_BlitSurface

Author: TrueCat17Created Jun 6, 2026Updated Sep 29, 2026

SDL ver.: 3.4.4

Perhaps I just misunderstand how this feature is supposed to work, but it seems to me that the existing behavior is incorrect and strange

In this example, I create an SDL_Surface with a palette filled from top to bottom with increasingly opaque pixels Next I try to convert it to RGBA32 convert1 does this manually and has exactly the behavior I want (simple copy)

But convert2 tries to do this using standard SDL functions (why using the SDL_BlitSurface function is a separate question) The most surprising thing for me here is that the result is affected by the blend-mode values of the source and destination surfaces at once In addition, to get the desired behavior, I need to set the source to NONE, and the target to BLEND (see comments), and I don’t understand - why not at least NONE for all?

The surface from convert1 is displayed on the left, and from convert2 - on the right

In the code in 2 conditions there are numbers 10, which can be conveniently changed to 0, here is what the different options look like:

0, 0 (BLEND -> BLEND) and 0, 10 (BLEND -> NONE) give the same result: Image

10, 0 (NONE -> BLEND): Image

10, 10 (NONE -> NONE): Image

Code: main.c