screencapture_grab()

Take a snapshot of the current display.

Synopsis:

#include <bps/screencapture.h>
 
BPS_API int screencapture_grab(const char *filename,
                               int format,
                               screencapture_result_t **result)

Since:

BlackBerry 10.2.0

Arguments:

filename

If NULL, the screenshot will be stored in the camera roll and the file name will be automatically generated. Otherwise, filename will be used as the file name. The path can be the absolute path, or a relative one. For example: "./data/mysnapshot.jpg" will store the snapshot in the application's data directory.

format

The format of the image, which is one of screencapture_format_t. If SCREENCAPTURE_FORMAT_FILENAME is used, the image format will be selected based on the extension from filename. Otherwise, the screen capture will be stored in the specified image format, regardless of filename.

result

If not NULL, screencapture_grab() will assign a result handle. The result handle can be used to get extended result information. The result handle needs to be destroyed by calling screencapture_destroy_result(). If it is NULL, no extended information will be provided.

Library:

libbps (For the qcc command, use the -l bps option to link against this library)

Description:

Take a snapshot of the current display. The resulting image will be stored based on the given filename, or placed in the camera roll.

An application must have the use_camera_desktop capability in order to use this function. To grant an application the use_camera_desktop capability, the bar-descriptor.xml file in the application's project must contain the line "<permission>use_camera_desktop</permission>".

Returns:

BPS_SUCCESS if the snapshot was successful. Otherwise, return BPS_FAILURE with errno set. Further error details are provided in the result handle, if available. If this function fails with the errno of ENOMEM, the result could not be allocated, and could not be returned to the user.