SDL_BlendOperation(3type)

πŸ’– SDL_BlendOperation πŸ’–

okay bestie, welcome to the SDL3 DATATYPES section of the manual, and today we're decoding SDL_BlendOperation β€” literally just the enum that decides how your source pixels and your destination pixels get mashed together when you blend. that's it, that's the whole vibe. no cap. πŸŽ€


✨ NAME ✨

SDL_BlendOperation β€” the blend operation used when combining source and destination pixel components. it's giving "math but make it fashion" πŸ’…


🌸 SYNOPSIS 🌸

first things first, you gotta pull in the header:

#include <SDL3/SDL_blendmode.h>

and here's the enum in all its glory, exactly as it lives in the source, comments and all, because we do not edit the queen's handwriting:

typedef enum SDL_BlendOperation
{
    SDL_BLENDOPERATION_ADD              = 0x1,  /**< dst + src: supported by all renderers */
    SDL_BLENDOPERATION_SUBTRACT         = 0x2,  /**< src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan */
    SDL_BLENDOPERATION_REV_SUBTRACT     = 0x3,  /**< dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan */
    SDL_BLENDOPERATION_MINIMUM          = 0x4,  /**< min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan */
    SDL_BLENDOPERATION_MAXIMUM          = 0x5   /**< max(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan */
} SDL_BlendOperation;

πŸ¦‹ the values, one by one πŸ¦‹

  • SDL_BLENDOPERATION_ADD β€” value 0x1. does dst + src. the people's champion, supported by all renderers. no exclusivity, no drama, everybody's invited to this party 🫢
  • SDL_BLENDOPERATION_SUBTRACT β€” value 0x2. does src - dst. supported by D3D, OpenGL, OpenGLES, and Vulkan. ok so read that order carefully bestie, it's src minus dst, not the other way around πŸ‘€
  • SDL_BLENDOPERATION_REV_SUBTRACT β€” value 0x3. does dst - src. supported by D3D, OpenGL, OpenGLES, and Vulkan. it's the reverse subtract, hence the name, the "rev" is doing a lot of heavy lifting here and honestly, good for it ✨
  • SDL_BLENDOPERATION_MINIMUM β€” value 0x4. does min(dst, src). supported by D3D, OpenGL, OpenGLES, and Vulkan. keeps whichever one is smaller, like when you and your bestie are picking a movie and you go with the shorter one because it's already late πŸŒ™
  • SDL_BLENDOPERATION_MAXIMUM β€” value 0x5. does max(dst, src). supported by D3D, OpenGL, OpenGLES, and Vulkan. keeps whichever one is bigger. main character energy, obviously πŸ‘‘
⚠️ real talk for one sec: only SDL_BLENDOPERATION_ADD is listed as supported by all renderers. the other four are only listed for D3D, OpenGL, OpenGLES, and Vulkan. so if you're out here on some other backend, that's a vibe check you need to run yourself πŸ™ˆ

πŸŽ€ AVAILABILITY πŸŽ€

this enum is available since SDL 3.2.0. so if you're on anything older, it's not ghosting you, it literally does not exist yet 😭


and that's the whole page, bestie, you ate it up fr fr πŸ’–

this was SDL_BlendOperation(3type) from the Simple Directmedia Layer, documented as of SDL 3.4.18 β€” go forth and blend responsibly, ily, bye 🧚✨

πŸ“¦ where this page comes from