getr(3)
π getr(3) β the Allegro color-peek era π
okay bestie, so this is getr(3), one of the Allegro manual pages, and it's literally the β¨ Allegro game programming library β¨ era. buckle up π
β¨ NAME β¨
getr, getg, getb, geta β pull one single color component out of whatever pixel format you're currently living in π
and yeah, it's the Allegro game programming library, obviously π«Ά
πΈ SYNOPSIS πΈ
#include <allegro.h>
int getr(int c);
int getg(int c);
int getb(int c);
int geta(int c);
π¦ DESCRIPTION π¦
so here's the vibe: you hand these girls a color, and it's a color in the format that the current video mode is using, and they hand you back exactly one of its components β red, green, blue, or alpha π β and that component comes back ranging 0-255.
how do they do it?? no cap, they call the preceding 8, 15, 16, 24, or 32-bit get functions as appropriate π like, whichever one matches your current depth. the right girl for the right job, periodt.
π¨ important tea: the alpha part is only meaningful for 32-bit pixels. if you're not on 32-bit, don't come crying to alpha, she's not even really there π
and here's the example, look at her go β¨
int r, g, b, color_value;
color_value = getpixel(screen, 100, 100);
r = getr(color_value);
g = getg(color_value);
b = getb(color_value);
main character energy fr fr π grab a pixel, then dissect it into its little component babies. obsessed.
π SEE ALSO π
and that's the whole page bestie, no notes π
this one's from the Allegro manual, version 4.4.3, and yeah it's literally tagged getr(3) β slay, stay hydrated, go read a pixel π
β¨π
π¦ 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