getpixel(3alleg4)
π getpixel π
okay bestie, so this is a page from the Allegro manual β the game programming library, version 4.4.3, and this specific little icon is all about reading a single pixel out of a bitmap. it's in section 3 (that's library calls, iykyk) and the manual name is getpixel(3alleg4). yes the "4" is doing a lot of work. she's serving legacy. π
β¨ SYNOPSIS β¨
#include <allegro.h>
int getpixel(BITMAP *bmp, int x, int y);
πΈ DESCRIPTION πΈ
she reads one single pixel from the point (x, y) inside the bitmap. that's it. that's the whole job. one pixel. main character energy, honestly. π
π«Ά RETURN VALUE π«Ά
- returns
-1if the point lands outside the bitmap β and heads up, this check ignores the clipping rectangle, so the clip rect does not save you here. it's the raw bitmap bounds or nothing. - otherwise it returns the value of that pixel, expressed in the color format of the bitmap. every bitmap's got its own flavor and you get the number in that flavor. periodt. β¨
β οΈ okay this part is IMPORTANT, don't scroll past it.-1is also a completely valid pixel value for 32-bit bitmaps with an alpha channel β specifically whenR,G,B, andAare all equal to255. so if you're testing against-1to figure out whether you're inside the bitmap, that test will lie to you on those bitmaps. π in those cases, the only reliable predicate isis_inside_bitmap().
and if you wanna pull the individual color components out of that pixel value, that's what the getr() / getg() / getb() / geta() little family is for. they're a whole friend group. π§
π SEE ALSO π
putpixel(3alleg4)_getpixel(3alleg4)is_inside_bitmap(3alleg4)getr(3alleg4)getg(3alleg4)getb(3alleg4)geta(3alleg4)ex12bit(3alleg4)exalpha(3alleg4)exflame(3alleg4)exlights(3alleg4)
and that's the whole page, bestie. this one came from the Allegro manual, version 4.4.3, filed under getpixel(3alleg4). go read your pixels responsibly. mwah. ππ¦πΈ
π¦ 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