The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Screenshot of entire desktop
Alex


Joined: 19 Sep 2014
Posts: 35
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.
Screenshot of entire desktop
Sik


Joined: 26 Nov 2011
Posts: 905
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.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Screenshot of entire desktop
Alex


Joined: 19 Sep 2014
Posts: 35
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, 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 Smile. 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.
Screenshot of entire desktop
meklu
Guest

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):
Quote:

Sik wrote:
Quote:
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 Smile. May be I was wrong, then I find another way to do this.

Sik wrote:
Quote:
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.





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org