Search code examples
colorspixelallegro5

Getting pixel color from display in allegro5


I've been trying to check if pixel color is green and I've seen this:

Checking pixel color Allegro 5 C++,

but I don't have bitmap in my code.

I was searching in allegro5 documentation and it seems like there's nothing which can help me.

Is there any solution to convert display to bitmap? Or to get pixel color from display? Anyone knows how to do it? I have position of my pixel and nothing more.


Solution

  • Use al_get_backbuffer to get the display as a bitmap, then use al_get_pixel to retrieve a pixel.