bitmap_mask_color(3alleg4)

πŸ’– NAME πŸ’–

okay so bitmap_mask_color β€” it hands you back the mask color of the bitmap you point at, bestie. it's from the Allegro game programming library, iykyk. πŸŽ€


✨ SYNOPSIS ✨

#include <allegro.h>

int bitmap_mask_color(BITMAP *bmp);

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically this function returns the mask color for whichever bitmap you pass in β€” and that's the value that gets skipped when sprites are being drawn. lowkey iconic behavior honestly.

here's the tea on what that color actually is:

  • for 256-color bitmaps it's zero.
  • for truecolor bitmaps it's bright pink β€” like, maximum red and maximum blue, and zero green. periodt. πŸ’…

a super frequent glow-up move with this function is clearing a bitmap with the mask color so you can later use that bitmap with masked_blit() or draw_sprite() after you've drawn other stuff on it. it's giving main character energy fr fr.

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);
not me looping over every pixel and vibe-checking it against the mask color 😭 but yes, that's literally the move.

πŸ‘‘ SEE ALSO πŸ‘‘


okay that's the whole page, bestie!! this was Allegro version 4.4.3, and yeah β€” bitmap_mask_color(3alleg4) said everything it needed to say. stay masked, stay slay πŸ«ΆπŸ’œπŸŒΈ