draw_character_ex(3alleg4)
β¨ draw_character_ex β bestie edition β¨
okay so this is a page from the Allegro manual (the 3alleg4 one, for the Allegro game programming library π) and it's literally about drawing a sprite's non-transparent pixels in a color. silhhouette vibes. icon behavior. let's go π«Ά
π NAME
draw_character_ex β draws the non transparent pixels of the sprite with a color, bestie. it's giving Allegro game programming library. periodt.
πΈ SYNOPSIS
#include <allegro.h>
void draw_character_ex(BITMAP *bmp, BITMAP *sprite, int x, int y, color,
bg);
no cap, that's the whole thing π
π¦ DESCRIPTION
so what it does: it draws a copy of the sprite bitmap onto the destination bitmap at the position you specify, and here's the twist β it draws the transparent pixels in the background color (or just skips them entirely if the background color is -1), and it sets all the other pixels to the specified color. so like, the whole thing comes out as one flat color silhouette. main character energy, honestly π
how do you even mark transparent pixels, you ask? with a zero in 256-color modes, or bright pink for truecolor data (that's maximum red and blue, zero green β the iconic magenta situation π ).
β οΈ important bestie: the sprite must be an 8-bit image, even if the destination is a truecolor bitmap. no exceptions. the vibe check is strict on this one.
example, because we love a demonstration β¨:
BITMAP *logo;
...
/* Draw the logo silhouette in red. */
draw_character_ex(screen, logo, SCREEN_W / 2, SCREEN_H / 2,
makecol(255, 0, 0), -1);
look at that. centered logo, fully red, transparent pixels skipped. we ate π₯
π SEE ALSO
and that's the whole page, babe π this was draw_character_ex(3alleg4) from the Allegro manual, version 4.4.3 β go forth and silhouette responsibly, ily ππ§
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms