Screenshot

The Screenshot object allows you to capture an image of the device screen.

Since: BlackBerry WebWorks 2.1

Installation:

To use this API in your project, add the screenshot plugin:

webworks plugin add com.blackberry.screenshot
Functions:
void execute()

execute()

Takes a screenshot and returns either a data-URL or path to image in the file system.

Synopsis:

void blackberry.screenshot.execute(options, onSuccess, onError)

Parameters:

options {Object}

Specifies how the screenshot is taken and saved.

rect: {x, y, w, h} {Object}
The rectangle to capture (optional; defaults to full screen).
  • Number x: horizontal displacement of the rectangle from the upper-left corner, in pixels.
  • Number y: vertical displacement of the rectangle from the upper-left corner, in pixels.
  • Number w: width of the rectangle in pixels.
  • Number h: height of the rectangle in pixels.
quality {Number}

The jpeg/png quality factor from 1-100 (default is 90).

dest {String}

Either "data:", which returns the image as a data URL (default) using mime argument, or a complete file path with extension, which saves the image to the file.

mime {String}

For "data:" destination, defines the mime type to encode (defaults to image/jpeg).

chmod {Number}

For screenshots to file, which chmod should be performed.

onSuccess {Function}

Callback function that is invoked when screenshot has been taken and is available as a data-URL or file in the file system.

onError {Function}

Callback function that is invoked if there was a problem taking or saving the screenshot.

Last modified: 2014-09-29



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus