SDL_BlendFactor(3type)

πŸ’– SDL_BlendFactor πŸ’–

okay so bestie, welcome to SDL_BlendFactor β€” it's a page from the SDL3 DATATYPES section of the manual and honestly? it's giving "small enum, huge power." sit down, grab a boba, we're learning about the little numbers that decide how your pixels blend together. 🫢


✨ NAME ✨

SDL_BlendFactor β€” the normalized factor used to multiply pixel components. that's it, that's the whole job. it's a multiplier. a vibe multiplier, if you will. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_blendmode.h>

typedef enum SDL_BlendFactor
{
    SDL_BLENDFACTOR_ZERO                = 0x1,  /**< 0, 0, 0, 0 */
    SDL_BLENDFACTOR_ONE                 = 0x2,  /**< 1, 1, 1, 1 */
    SDL_BLENDFACTOR_SRC_COLOR           = 0x3,  /**< srcR, srcG, srcB, srcA */
    SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4,  /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
    SDL_BLENDFACTOR_SRC_ALPHA           = 0x5,  /**< srcA, srcA, srcA, srcA */
    SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6,  /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
    SDL_BLENDFACTOR_DST_COLOR           = 0x7,  /**< dstR, dstG, dstB, dstA */
    SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8,  /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
    SDL_BLENDFACTOR_DST_ALPHA           = 0x9,  /**< dstA, dstA, dstA, dstA */
    SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA   /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
} SDL_BlendFactor;

okay look at that list. ten whole factors, each one with its own lil comment telling you exactly what it spits out. iconic behavior honestly. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” these blend factors get multiplied with the pixels coming out of a drawing operation (that's your src, the source, the main character) and with the pixels already sitting in the render target (that's your dst, the destination, the one holding down the fort). and all of that math happens before the blend operation itself. sequencing matters, bestie. πŸ’…

and those comma-separated factors listed up there in the synopsis? they're always applied in the component order red, green, blue, and alpha. every single time. no cap. so when you see srcR, srcG, srcB, srcA you know exactly which channel gets which value, in that exact order. πŸŽ€


⭐ AVAILABILITY ⭐

this enum has been available since SDL 3.2.0. so if you're on anything older, it's not ghosting you β€” it just literally doesn't exist yet. 😭


lowkey reminder: the factor values are normalized, meaning they're the multipliers you feed into the blend math β€” not the final pixel values. don't get it twisted. 🫢

and that's the whole page, bestie!! no notes, ate and left no crumbs. πŸ‘‘

Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_BlendFactor(3type) β€” mwah, sending you the biggest kiss, go blend something gorgeous. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from