makecol15_dither(3alleg4)
π makecol15_dither β bestie edition π
okay so this is a page from the Allegro manual (that's the 3alleg4 section, iykyk) and it's about two lil functions that make dithered 15-bit and 16-bit RGB values for you. no cap, they're lowkey iconic for retro graphics.
β¨ NAME β¨
makecol15_dither, makecol16_dither β they calculate a dithered 15-bit or 16-bit RGB value. yes bestie, that's the whole job. it's giving "Allegro game programming library" energy π
π¦ SYNOPSIS π¦
#include <allegro.h>
int makecol15_dither(int r, int g, int b, int x, int y);
int makecol16_dither(int r, int g, int b, int x, int y);
like, include the header, call the function, get a color. simple as that fr fr.
πΈ DESCRIPTION πΈ
so here's the tea β: you hand over both a color value and a pixel coordinate, and these functions hand you back a dithered 15-bit or 16-bit RGB value. the whole point is that this can produce better results when reducing images from truecolor down to hicolor. she's not just a color maker, she's a color glow-up specialist.
and it gets better β you don't even have to call these directly if you don't wanna. hicolor dithering can be automatically enabled when you load graphics, by calling the set_color_conversion() function. for example:
set_color_conversion(COLORCONV_REDUCE_TRUE_TO_HI | COLORCONV_DITHER);
look at that flag combo. the way that COLORCONV_REDUCE_TRUE_TO_HI and COLORCONV_DITHER are just vibing together with a |? obsessed. π
π Example π
here's the example straight from the page, and pls read the comment because it's important:
int pixel1, pixel2;
/* The following two color values MAY be different. */
pixel1 = makecol16_dither(255, 192, 64, 0, 0);
pixel2 = makecol16_dither(255, 192, 64, 1, 0);
notice how the RGB values are identical but the coordinates are different (0, 0 vs 1, 0) β and the results MAY be different. that's the dithering doing its little thing. main character behavior honestly. β¨
π« RETURN VALUE π«
returns the RGB value, dithered for the specified coordinate. that's it, that's the return. no drama, just a dithered color. π«Ά
π SEE ALSO π
go read these next bestie, they're all in the same friend group:
β οΈ reminder that the two color values in the example MAY be different β that's not a bug, that's literally the dithering working as intended. don't come for her. π
and that's the whole page, bestie! this was Allegro version 4.4.3 and the manual page is makecol15_dither(3alleg4). go forth and dither responsibly. slay π
πβ
π¦ 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