SDL_SetSurfaceBlendMode(3)

πŸ’– SDL_SetSurfaceBlendMode πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_SetSurfaceBlendMode(3) β€” the lil function that decides how your surface blends when it gets blitted. slay.


✨ NAME ✨

SDL_SetSurfaceBlendMode β€” set the blend mode used for blit operations. that's it, that's the whole job πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_surface.h>

bool SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: if you wanna copy a surface onto another surface (or a texture) and you want it to just replace the existing data β€” no blending, no mixing, no cute little alpha math β€” then the blend mode of the SOURCE surface should be set to SDL_BLENDMODE_NONE. periodt. that's the move πŸ’…


πŸ‘‘ FUNCTION PARAMETERS πŸ‘‘

  • surface β€” the SDL_Surface structure you're updating. yes, that one. your fave.
  • blendMode β€” the SDL_BlendMode to use for blit blending. this is the vibe you're choosing ✨

πŸ’€ RETURN VALUE πŸ’€

returns true on success or false on failure. and if it fails? call SDL_GetError() for more info, because it will tell you what went wrong, fr fr 😭


🧚 THREAD SAFETY 🧚

this function can be called on different threads with different surfaces. so like, multitask girlie, but keep your surfaces separate, mkay? 🫢


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0. vintage but make it iconic ⭐


πŸ”₯ SEE ALSO πŸ”₯


lowkey obsessed with how simple this one is. no cap, just set the blend mode and let it slay.

okay bye bestie, this page came to you from Simple Directmedia Layer πŸ’– and it's living in SDL 3.4.18 β€” mwah, take care, drink water, and remember: SDL_BLENDMODE_NONE on the source surface is how you copy without the blending drama πŸŒΈπŸ’…βœ¨

πŸ“¦ where this page comes from