getr_depth(3alleg4)
π getr_depth β okay bestie, let's talk color components π
So this is getr_depth(3alleg4) from the Allegro manual, and it's honestly such a helpful little squad of functions. Allegro game programming library, if you didn't know. π
β¨ NAME β¨
getr_depth, getg_depth, getb_depth, geta_depth β extract a color component from a color in a specified pixel format. Allegro game programming library. π¦
πΈ SYNOPSIS πΈ
#include <allegro.h>
int getr_depth(int color_depth, int c);
int getg_depth(int color_depth, int c);
int getb_depth(int color_depth, int c);
int geta_depth(int color_depth, int c);
π DESCRIPTION π
Okay so here's the vibe: you hand these functions a color that's in the format being used by the color depth you specify, and they pull out one of the components β red, green, blue, or alpha β ranging 0-255. That's it, that's the whole job, and they do it flawlessly. π
Heads up bestie: the alpha part is only meaningful for 32-bit pixels. For anything less, don't come for alpha, she's not there. π
And here's an example, because of course there's an example, we love a demo: β¨
int r, g, b, color_value, bpp;
bpp = bitmap_color_depth(bitmap);
color_value = getpixel(bitmap, 100, 100);
r = getr_depth(bpp, color_value);
g = getg_depth(bpp, color_value);
b = getb_depth(bpp, color_value);
Look at that. Grab the depth, grab the pixel, split it into her components. Main character energy fr fr. π
π«Ά SEE ALSO π«Ά
getr(3alleg4)getr8(3alleg4)geta32(3alleg4)makecol(3alleg4)set_color_depth(3alleg4)exlights(3alleg4)
Allegro, version 4.4.3 β that's the whole page, bestie, you ate it up. Go forth and extract those components. Not me being obsessed with a manpage. πβ¨ππ¦πΈπ π«Άππ₯ππβππππ§π
π¦ 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