masked_blit(3)
π masked_blit(3) π
okay bestie, welcome to the masked_blit(3) page from the Allegro manual β yes that Allegro, the game programming library, and yes this function is lowkey iconic.
β¨ NAME β¨
masked_blit β copies a rectangle while skipping pixels that match the mask color. It's part of the Allegro game programming library. π
β¨ SYNOPSIS β¨
#include <allegro.h>
void masked_blit(BITMAP *source, BITMAP *dest, int source_x, int
source_y, int dest_x, int dest_y, int width, int height);
β¨ DESCRIPTION β¨
It's giving blit(), but with main character energy: it skips transparent pixels entirely. And what counts as transparent, you ask? In 256-color modes it's a zero, and for truecolor data it's bright pink β meaning maximum red and blue with zero green. periodt. π
Two rules, no cap:
- the source and destination bitmaps must be the same color depth π«Ά
- the source and destination regions must not overlap π
Here's an example, straight from the source:
BITMAP *hud_overlay;
...
/* Paint hud overlay on the screen. */
masked_blit(hud_overlay, screen, 0, 0, 0, 0,
hud_overlay->w, hud_overlay->h);
Now, if the GFX_HW_VRAM_BLIT_MASKED bit is set in the gfx_capabilities flag, that means your current driver supports hardware accelerated masked blits from one part of the screen onto another. That is extremely fast, so when this flag is set it may genuinely be worth storing some of your more frequently used sprites in an offscreen portion of the video memory. β¨
β οΈ Warning bestie, listen: if the hardware acceleration flag is not set, masked_blit() will not work correctly when used with a source image in system or video memory β so the latter must be a memory bitmap. Not me warning you twice. π
β¨ SEE ALSO β¨
that's the whole vibe, bestie πΈ this was Allegro version 4.4.3, and yeah, it's a masked_blit(3) situation. go forth and skip those pixels ππ¦π
π¦ 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