bitmap_mask_color(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– 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