rgb_map(3)

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

πŸ’– rgb_map(3) β€” the glow-up lookup table πŸ’–

okay bestie, so this is a page from the Allegro manual β€” specifically the one about rgb_map, the look up table that speeds up reducing RGB values to palette colors. it's giving Allegro game programming library, and honestly? iconic. ✨


✨ SYNOPSIS ✨

#include <allegro.h>

extern RGB_MAP *rgb_map;

that's it. that's the whole vibe. one little global pointer, so much power. 🫢


🌸 DESCRIPTION 🌸

so here's the tea, bestie: to speed up reducing RGB values to 8-bit paletted colors, Allegro uses a 32k lookup table β€” and the way that works is it gives 5 bits to each color component. five bits each. cute, compact, efficient. πŸ’…

you must set up this table before you use the gouraud shading routines. like, that's not optional, that's the rule. no table, no gouraud. periodt.

but also β€” and this is the part that's genuinely obsessed-worthy β€” if the table is present, it will also vastly accelerate makecol8() and some create_*_table() functions. free speed. we love a multitasker. πŸ‘‘

and how do you get one of these tables, you ask? two ways, bestie:

  • you can precalculate RGB tables with the rgbmap utility πŸ”₯
  • or you can generate them at runtime with create_rgb_table() ✨

pick your fighter. either way, you're slaying.


πŸ‘€ SEE ALSO πŸ‘€

your reading list, no skips:


and that's the whole page, bestie!! this lil masterpiece came to you straight from the Allegro manual, version 4.4.3 β€” no date on the footer, just the version, so that's all we're claiming. go set up your lookup table and be free πŸ¦‹πŸ’–

πŸ“¦ where this page comes from