25 #define PIX_COLOR_NONE 0x00000000u 36 #define PIX_COLOR_RED 0xFF0000FFu 37 #define PIX_COLOR_GREEN 0x00FF00FFu 38 #define PIX_COLOR_BLUE 0x0000FFFFu 39 #define PIX_COLOR_WHITE 0xFFFFFFFFu 40 #define PIX_COLOR_BLACK 0x000000FFu 46 #define PIX_COLOR_RGBA(r, g, b, a) \ 47 ((pix_color_t)(((uint32_t)(uint8_t)(r) << 24) | \ 48 ((uint32_t)(uint8_t)(g) << 16) | \ 49 ((uint32_t)(uint8_t)(b) << 8) | \ 50 (uint32_t)(uint8_t)(a))) 56 #define PIX_COLOR_RGB(r, g, b) PIX_COLOR_RGBA(r, g, b, 0xFFu) 63 return (uint8_t)(color >> 24);
71 return (uint8_t)(color >> 16);
79 return (uint8_t)(color >> 8);
87 return (uint8_t)color;
102 uint32_t ia = 255u - sa;
109 uint32_t out_a = sa + (da * ia + 127u) / 255u;
114 uint32_t denom = out_a * 255u;
115 uint32_t half = denom / 2u;
116 uint8_t r = (uint8_t)((
pix_color_r(src) * sa * 255u +
118 uint8_t g = (uint8_t)((
pix_color_g(src) * sa * 255u +
120 uint8_t b = (uint8_t)((
pix_color_b(src) * sa * 255u +
static uint8_t pix_color_b(pix_color_t color)
Extract the blue channel.
static uint8_t pix_color_a(pix_color_t color)
Extract the alpha channel.
uint32_t pix_color_t
Color value type for pixel operations.
static uint8_t pix_color_r(pix_color_t color)
Extract the red channel.
#define PIX_COLOR_NONE
Fully transparent (all channels zero) - a "no color" sentinel, distinct from the opaque PIX_COLOR_BLA...
#define PIX_COLOR_RGBA(r, g, b, a)
Construct a pix_color_t from separate R/G/B/A components.
static pix_color_t pix_color_blend(pix_color_t src, pix_color_t dst)
Alpha-composite src over dst ("over" compositing).
static uint8_t pix_color_g(pix_color_t color)
Extract the green channel.