Screenshot of entire desktop

Hello.
Is it possible to make a screenshot of entire desktop with SDL2? I mean all what we see on the screen, not only inside my window. Or I need to search for other way (without SDL) to make this screenshot?
Thanks for answers.

In short: no, you can’t. You’ll need to use whatever the OS provides
you to take such a screenshot.

Also first ask yourself why do you need to take a screenshot of the
entire screen.

Sik wrote:

In short: no, you can’t. You’ll need to use whatever the OS provides
you to take such a screenshot.

It’s ok. Why I asking: when I compile and start this example (http://wiki.libsdl.org/SDL_CreateWindow#Code_Examples), I see a part of desktop image inside my window. Looks like window is transparent. Then I think: if this window contain part of desktop image, then may be possible to get this graphics data :). May be I was wrong, then I find another way to do this.

Sik wrote:

Also first ask yourself why do you need to take a screenshot of the
entire screen.

I want to make small application, using SDL, which take a screenshot of entire screen and make some processing on this screenshot. Like a very simple graphic editor for screenshots.

The reason you’re seeing parts of the desktop is probably the fact that you’re not clearing the window surface. Very often it will have some framebuffer garbage in it. To mitigate this effect you could create a hidden window (add SDL_WINDOW_HIDDEN to the flags), clear it, and show it with SDL_ShowWindow().–
Melker Narikka

Alex kirjoitti Mon Oct 06 2014 17:50:47 GMT+0300 (EEST):

Sik wrote:

In short: no, you can’t. You’ll need to use whatever the OS provides
you to take such a screenshot.

It’s ok. Why I asking: when I compile and start this example (http://wiki.libsdl.org/SDL_CreateWindow#Code_Examples), I see a part of desktop image inside my window. Looks like window is transparent. Then I think: if this window contain part of desktop image, then may be possible to get this graphics data :). May be I was wrong, then I find another way to do this.

Sik wrote:

Also first ask yourself why do you need to take a screenshot of the
entire screen.

I want to make small application, using SDL, which take a screenshot of entire screen and make some processing on this screenshot. Like a very simple graphic editor for screenshots.