create_trans_table(3)
π create_trans_table β bestie edition π
ok so this is a page from the Allegro manual, section 3, and it's all about create_trans_table. it's giving game-programming-glow-up energy and honestly? we're obsessed. β¨
πΈ NAME πΈ
create_trans_table β fills a color mapping table for translucency effects. yep, it's the Allegro game programming library, and yes she's iconic for this one π
π¦ SYNOPSIS π¦
#include <allegro.h>
void create_trans_table(COLOR_MAP *table, const PALETTE pal, int r, g,
b, void (*callback)(int pos));
like, that's the whole signature. short. sweet. main character. π
β¨ DESCRIPTION β¨
okay so here's the vibe: create_trans_table fills the color mapping table you hand it (table) with lookup data for doing translucency effects with the palette you give it (pal). π
when you combine the colors c1 and c2 using this table, the result is gonna be a color somewhere between the two. not one, not the other, a little secret third thing. no cap.
the r, g, and b parameters specify the solidity of each color component, ranging from 0 (totally transparent) to 255 (totally solid). so like:
0= ghost mode, fully see-through π»255= fully there, no notes- and for 50% solidity, you pass
128. remember that number, bestie, it's the moment. π
now for the special-case lore: this function treats source color #0 as a special case, leaving the destination unchanged whenever a zero source pixel is encountered β that way masked sprites draw correctly. it's the little detail that saves your whole render. π«Ά
also, this function will take advantage of the global rgb_map variable to speed up color conversions. efficiency queen. β‘
and if the callback function is not NULL, it will be called 256 times during the calculation, which means you can totally show off a progress indicator while it chugs along. π so thoughtful.
example time, look at her:
COLOR_MAP trans_table;
...
/* Build a color lookup table for translucent drawing. */
create_trans_table(&trans_table, pal, 128, 128, 128, NULL);
π SEE ALSO π
color_map(3)create_light_table(3)create_color_table(3)create_blender_table(3)draw_trans_sprite(3)draw_lit_sprite(3)draw_gouraud_sprite(3)rgb_map(3)ex3d(3)extrans(3)
go read those too, they're all in the same friend group fr fr π
and that's the page!! this was Allegro, version 4.4.3, and the date on this one was the create_trans_table(3) era β so go forth and blend your sprites beautifully, bestie. you ate. π β¨π¦
π¦ 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