draw_trans_rle_sprite(3alleg4)
β¨ draw_trans_rle_sprite β bestie edition β¨
okay so you want a translucent RLE sprite on your screen?? say less π
this is from the Allegro game programming library (yes, the 3alleg4 manual, we're fancy here), and it's literally the see-through version of drawing an RLE sprite. slay.
π¦ SYNOPSIS π¦
#include <allegro.h>
void draw_trans_rle_sprite(BITMAP *bmp, const RLE_SPRITE *sprite, int x,
int y);
that's it. that's the whole function signature. no cap. π«Ά
πΈ DESCRIPTION πΈ
So this is the translucent version of draw_rle_sprite() β like, it does the same thing but the sprite is see-through. ghost vibes. π» If you wanna know more about the transparency side of things, go read the description of draw_trans_sprite().
β οΈ IMPORTANT BESTIE, LISTEN: you can only use this after you've set up the color mapping table (for 256-color modes) or the blender functions (for truecolor modes). Don't skip this step, it's giving "crashing at 3am" energy and we don't want that. π
Normally the bitmap and the sprite have to be in the same color depth β that's just the rules, sorry. BUT as a special lil exception: you can draw 32-bit RGBA format sprites onto any hicolor or truecolor bitmap, as long as you call set_alpha_blender() first. iconic behavior honestly. β¨
Here's the example, straight from the source, keep it exact bestie:
/* Some one time initialisation code. */
COLOR_MAP global_trans_table;
create_trans_table(&global_trans_table, my_palette,
128, 128, 128, NULL);
...
if (get_color_depth() == 8)
color_map = &global_trans_table;
else
set_trans_blender(128, 128, 128, 128);
draw_trans_rle_sprite(buffer, rle_ghost_sprite, x, y);
see how the ... is just hanging out there? that's the "the rest of your code goes here" moment. main character pause. π
π SEE ALSO π
the girlies you should also go read, fr fr:
draw_rle_sprite(3alleg4)draw_lit_rle_sprite(3alleg4)draw_trans_sprite(3alleg4)color_map(3alleg4)set_trans_blender(3alleg4)set_alpha_blender(3alleg4)bitmap_mask_color(3alleg4)
okay that's the whole page, you ate that π this was Allegro, version 4.4.3, and it's the draw_trans_rle_sprite(3alleg4) manual page β go forth and draw translucent sprites like the icon you are. bye bestie πβ¨
π¦ 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