draw_trans_rle_sprite(3)

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

πŸ’– draw_trans_rle_sprite(3) πŸ’–

okay bestie, we're in the Allegro manual today and this one is genuinely iconic β€” it's giving ghost sprite energy, and i'm obsessed 🫢


✨ NAME ✨

draw_trans_rle_sprite β€” draws a translucent RLE sprite. it's part of the Allegro game programming library, no cap πŸ‘‘


✨ SYNOPSIS ✨

#include <allegro.h>

void draw_trans_rle_sprite(BITMAP *bmp, const RLE_SPRITE *sprite, int x,
int y);

✨ DESCRIPTION ✨

so this is literally the translucent version of draw_rle_sprite(). if you wanna know the whole vibe, go read the description of draw_trans_sprite(). πŸ’…

⚠️ important bestie, do NOT skip this: you can only use this after you've set up the color mapping table (that's for the 256-color modes) or the blender functions (that's for truecolor modes). like, it just won't work otherwise. periodt.

now, about depths β€” the bitmap and the sprite have to normally be the same color depth, okay? but there's one special case, and it's kind of a slay: you can draw 32-bit RGBA format sprites onto any hicolor or truecolor bitmap, as long as you call set_alpha_blender() first. yes, first. before. not after. 😭

here's the example, look at her:

/* 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 she checks the color depth and picks her path? main character behavior fr fr 🌸


✨ SEE ALSO ✨

go read those too, they're all part of the same friend group πŸ¦‹


and that's the whole page, bestie!! this was Allegro, version 4.4.3, and you just read draw_trans_rle_sprite(3) β€” stay translucent, stay iconic, and don't forget to set your blender functions before you draw πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from