Taking a screenshot of a window in C using only the X11 lib
You will manually have to get color values of all the pixels and then convert it to a format of your choice.
AFAIK, there is no "simple" way to do it.
You can check with this question here: How do take a screenshot correctly with xlib?
Fastest method for screen capturing on Linux
This is possible using VirtualGL in a server with hardware acceleration. Basically just configure the server appropiately, then either on the same machine or on a machine in the same network, run
export DISPLAY=<your xvfb display>
vglrun <your_app>
This will have the following advantages:
1) your app will render using virtualGL, which will use the hardware
2) VirtualGL will display your 3D context inside the Xfvb display, which will only render the 2D widgets in CPU
3) configure Xvfb to render to a framebuffer
4) profit!
Screen Capture Specific Window
Yes it is. All what you need is get handle to window which you want to capture and use WinAPI function PrintWindow for example:
// Get the window handle of calculator application.
HWND hWnd = ::FindWindow( 0, _T( "Calculator" ));
// Take screenshot.
PrintWindow( hWnd, getDC(hWnd), 0 );
Here you have PrintWindow documentation.
How to take screen shot of whole desktop without background/wallpaper picture in Windows
Disabling the wallpaper is going to cause an annoying flicker/redraw. I expect, anyway.
It would be cleaner to enumerate all of the windows on the desktop that are visible, find their dimensions/position, and then determine the area outside of all of those rectangles. Make that area invisible. i.e. white, to save paper when printing, or another color to suit your purpose. This answer is just to describe the general approach, but I think it's the way to go, unless some magic "silver bullet" appears.
Related Topics
How to Fix Urllib3 Runtimeerror: Requests Dependency 'Urllib3' Must Be Version >= 1.21.1, < 1.22
Installing PHPsh on Linux, Python Error
Difference Between ./Executable and . Executable
Sox Batch Process Under Debian
Add a Directory When Creating Tar Archive
Pipe Sox Play Command to Stdout
Difference Between Posix Reliable Signals and Posix Real-Time Signals in Linux
How to Disable Qt's Behavior on Linux of Capturing Arrow Keys for Widget Focus Navigation
Placement of '-L' Option in Gcc
Is It Necessary to Flush Write Combine Memory Explicitly by Programmer
How to Join Multiple Txt Files into Based on Column
Listening for New Processes in Linux Kernel Module
Toolchain to Crosscompile Applications for Bbb
Setting Path to Shared Library Inside a Makefile for Compile
How to Include Cutil.H in Linux