There are tools like Screenshot tools, Game Macro Tools and others that can read and write pixel data directly from the visible framebuffer that is presented to the user. So there must be an API that allows one to read and possibly write directly to these arrays of pixels.
What are the APIs used to accomplish this in either Linux or Windows? Both OSes must to have some kind of systemcall to do this.
How to read the screen pixels? only gets answered by giving a huge code example with an unspecified library without explaining includes or portability (seems to be Windows Exclusive stuff).