bitmap_mask_color(3)
π NAME π
bitmap_mask_color β bestie, this one hands you back the mask color of whatever bitmap you point it at. It's part of the Allegro game programming library, and it's giving tiny but mighty. β¨
π SYNOPSIS π
#include <allegro.h>
int bitmap_mask_color(BITMAP *bmp);
β¨ DESCRIPTION β¨
Okay so here's the tea: bitmap_mask_color returns the mask color for the bitmap you pass in β and that's literally the value that gets skipped when you're drawing sprites. Like, it's the color that means "not me, don't draw me" π«₯π
The rules are simple, no cap:
- For 256-color bitmaps the mask color is zero.
- For truecolor bitmaps</truecolor> it's bright pink β that's maximum red, maximum blue, and zero green. Iconic choice tbh. π©·
A super frequent use of this function (and honestly the main character move here) is clearing a bitmap with the mask color, so that later you can use that bitmap with masked_blit() or draw_sprite() after you've drawn other stuff on it. Chef's kiss. ππ
Example, bestie:
/* Replace mask color with another color. */
for (y = 0; y h; y++)
for (x = 0; x w; x++)
if (getpixel(bmp, x, y) == bitmap_mask_color(bmp))
putpixel(bmp, x, y, another_color);
πΈ SEE ALSO πΈ
Allegro β version 4.4.3 β bitmap_mask_color(3). That's the whole page, bestie, go forth and mask your colors ππ¦π§
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms