_getpixel(3alleg4)

πŸ’– _getpixel, _getpixel15, _getpixel16, _getpixel24, _getpixel32 πŸ’–

okay bestie, listen up β€” this is a page from the Allegro manual (that's the 3alleg4 section, iykyk), and it's about the speedrun versions of getpixel(). Five of them. One for each vibe of color depth. Let's go 🫢


✨ SYNOPSIS ✨

#include <allegro.h>

int _getpixel(BITMAP *bmp, int x, int y);

int _getpixel15(BITMAP *bmp, int x, int y);

int _getpixel16(BITMAP *bmp, int x, int y);

int _getpixel24(BITMAP *bmp, int x, int y);

int _getpixel32(BITMAP *bmp, int x, int y);

like. five whole functions. one include. we love a clean synopsis ✨


🌸 DESCRIPTION 🌸

So here's the tea, bestie: these are faster inline versions of getpixel() β€” but they're specialized, one per specific color depth. Not a one-size-fits-all situation. Each one knows exactly how deep your colors go and grabs that pixel accordingly. main character energy πŸ’…

But β€” and this is important, no cap β€” two big caveats:

  • They won't work in mode-X. at all. not a vibe.
  • They don't do any clipping. like zero. none. so you have to make sure the point actually lies inside the bitmap, or you're on your own 😭
fr fr, check your bounds yourself. these functions are trusting you and that is a lot of trust to be given πŸ™ˆ

πŸŽ€ RETURN VALUE πŸŽ€

It returns the value of the pixel, in the color format you specified. so whatever depth you picked, that's the flavor of number you get back. slay πŸ’–


πŸ¦‹ SEE ALSO πŸ¦‹

  • getpixel(3alleg4) β€” the chill, do-everything, clip-for-you version. the original. the blueprint. πŸ‘‘

mwah πŸ’œ this has been the Allegro manual, version 4.4.3, page _getpixel(3alleg4). go forth and read pixels responsibly, bestie 🌈✨