SDL_PremultiplySurfaceAlpha(3)
π SDL_PremultiplySurfaceAlpha(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual π β today's main character is SDL_PremultiplySurfaceAlpha, and she is so useful, no cap.
β¨ NAME β¨
SDL_PremultiplySurfaceAlpha β premultiply the alpha in a surface. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_surface.h>
bool SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, bool linear);
π¦ DESCRIPTION π¦
This is safe to use with src == dst, but not for other overlapping areas.
so like, if your source and destination are literally the same thing, you're golden β¨. but overlapping-but-not-identical areas? nope, that's giving chaos, don't do it π
π FUNCTION PARAMETERS π
surfaceβ the surface to modify. this is the glow-up recipient, the one getting the alpha premultiplied π«Άlinearβ passtrueto convert from sRGB to linear space for the alpha multiplication, orfalseto do the multiplication in sRGB space. pick your fighter, both are valid π
β RETURN VALUE β
Returns true on success or false on failure β and if it fails, call SDL_GetError() for more information, because she will tell you what went wrong, bestie π
π§ THREAD SAFETY π§
This function can be called on different threads with different surfaces. so like, multitasking queen energy, as long as everybody's got their own surface π
not me gently reminding you: different surfaces on different threads. sharing one surface across threads is not the move π
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on anything older, it's giving dust, upgrade fr fr π¦β¨
and that's the whole page, periodt. π
simple directmedia layer, SDL 3.4.18, SDL_PremultiplySurfaceAlpha(3) β mwah, love u, go premultiply responsibly ππ·π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms