create_trans_table(3alleg4)
π create_trans_table β the translucency table glow-up β¨
okay bestie, so this one lives in the Allegro game programming library, and it's in manual section 3alleg4 if you were wondering where to find it π«Ά
πΈ NAME πΈ
create_trans_table β fills a color mapping table for translucency effects, brought to you by the Allegro game programming library π
β¨ SYNOPSIS β¨
#include <allegro.h>
void create_trans_table(COLOR_MAP *table, const PALETTE pal, int r, g, b,
void (*callback)(int pos));
π¦ DESCRIPTION π¦
So basically? This function fills the color mapping table you hand it (table) with all the lookup data you need to do translucency effects using the palette you specify (pal). β¨
When you combine two colors, c1 and c2, using this table, the result is a color that lands somewhere in between the two. Not exactly one, not exactly the other β a lil blend, a lil moment π
Now the r, g, and b params? They set the solidity of each color component, and the range goes from 0 (totally transparent, see-through, ghost mode π») all the way up to 255 (totally solid, no cap πͺ). And if you want that classic 50% solidity, you just pass 128. That's the vibe.
π Heads up bestie: this function treats source color #0 as a special case β it leaves the destination unchanged whenever a zero source pixel shows up, so that masked sprites will draw correctly. Important, don't skip it.
Also, this function will lowkey take advantage of the global rgb_map variable to speed up color conversions π₯ iconic behavior honestly.
And if the callback function is not NULL, it gets called 256 times during the calculation, which is your moment to display a progress indicator. main character progress bar energy π
Example time, periodt:
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(3alleg4)create_light_table(3alleg4)create_color_table(3alleg4)create_blender_table(3alleg4)draw_trans_sprite(3alleg4)draw_lit_sprite(3alleg4)draw_gouraud_sprite(3alleg4)rgb_map(3alleg4)ex3d(3alleg4)extrans(3alleg4)
and that's the whole page, bestie π§π this was Allegro version 4.4.3, create_trans_table(3alleg4) β go build something translucent and gorgeous, you ate fr fr ππβ
π¦ 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