getr8(3alleg4)

πŸ’– getr8 β€” the "gimme just the red/green/blue bestie" collection πŸ’–

okay so this is a whole family of functions from the Allegro game programming library, and they're all about pulling one single colour component out of a pixel. yes, the whole squad showed up. let's go 🫢


✨ NAME ✨

getr8, getg8, getb8, getr15, getg15, getb15, getr16, getg16, getb16, getr24, getg24, getb24, getr32, getg32, getb32 β€” extract a colour component from the specified pixel format. Allegro game programming library. πŸ’…


🌈 SYNOPSIS 🌈

#include <allegro.h>

int getr8(int c);

int getg8(int c);

int getb8(int c);

int getr15(int c);

int getg15(int c);

int getb15(int c);

int getr16(int c);

int getg16(int c);

int getb16(int c);

int getr24(int c);

int getg24(int c);

int getb24(int c);

int getr32(int c);

int getg32(int c);

int getb32(int c);

πŸŽ€ DESCRIPTION πŸŽ€

so like. you hand one of these a colour that's in a display dependent format, and it hands you back one of the red, green, or blue components β€” and that component is ranging 0-255, no cap. that's the whole vibe. the number at the end of each name is just telling you which pixel depth it's built for, bestie. ✨

here's the example, literally copied exactly because I would never do you like that:

int r, g, b, color_value;

color_value = _getpixel15(screen, 100, 100);
r = getr15(color_value);
g = getg15(color_value);
b = getb15(color_value);

see? grab the pixel, then break it down into its little r/g/b pieces. it's giving forensics. πŸ”₯


πŸ¦‹ SEE ALSO πŸ¦‹


mwah πŸ’‹ that's the page! this was Allegro version 4.4.3, and honestly she ate. go extract some components, bestie, you've got this. πŸŽ€βœ¨πŸ’–