Take a screenshot of the display and store the resulting image in the specified buffer


#include <screen/screen.h>
int screen_read_display(screen_display_t disp,
                        screen_buffer_t buf,
                        int count,
                        const int *read_rects,
                        int flags)


The handle of the display that's the target of the screenshot.
The buffer where the resulting image is stored.
The number of rectables supplied in the read_rects argument.
A pointer to (count * 4) integers that define the areas of display that need to be grabbed for the screenshot.
For future use. Pass 0 for now.




Function Type: Immediate Execution

This function takes a screenshot of a display and stores the result in a user-provided buffer. The buffer can be a pixmap buffer or a window buffer. The buffer must have been created with the usage flag SCREEN_USAGE_NATIVE in order for the operation to succeed. You need to be working within a privileged context so that you have full access to the display properties of the system. Therefore, a context which was created with the type SCREEN_DISPLAY_MANAGER_CONTEXT must be used. When capturing screenshots of multiple displays, you will need to make one screen_read_display() function call per display. This function blocks until the operation is completed. If count is 0 and read_rects is NULL, the entire display is grabbed. Otherwise, read_rects must point to (count * 4) integers defining rectangles in display coordinates that need to be grabbed. Note that the buffer size doesn't have to match the display size. Scaling is applied to make the screenshot fit into the buffer that's provided.


0 if successful, or -1 if an error occurred (errno is set; refer to errno.h for more details).