## org.autoplot.ScreenshotsTool

Jeremy's experiment that will create automatic documentation. This is intended to provide a means for users to more easily communicate and to make it easier to create documentation. This is being modified a bit, namely to delay work such as screening private regions, to improve responsiveness and to allow the user the option of screening or not.

## ScreenshotsTool( java.awt.Window parent, String outLocationFolder )

create a new ScreenshotsTool, which will write screenshots to the location.

## ScreenshotsTool( java.awt.Window parent, String outLocationFolder, boolean clearFolder )

create a new ScreenshotsTool, which will write screenshots to the location. The output folder must not exist or be empty, or clearFolder must be set to true. This is created and then pushed to the event stack, so that screenshots will be taken when activity occurs (see start which manages this), or will takePicture is called to manually take screenshots (e.g. from scripts). When the session is done, requestFinish is called to clean up.

## dispatchEvent

dispatchEvent( java.awt.AWTEvent theEvent ) → void

### Parameters

theEvent - an AWTEvent

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getScreenShot

getScreenShot( ) → java.awt.image.BufferedImage

get a screenshot of the display Autoplot's main UI is running within.

### Returns:

a java.awt.image.BufferedImage
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getScreenShot

getScreenShot( int active ) → java.awt.image.BufferedImage

Get a screenshot of the display indicated by active. Only one screen of a dual-head is returned.

### Parameters

active - the display number. See getActiveDisplay(window);

### Returns:

image of the screen.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getScreenShotNoPointer

getScreenShotNoPointer( ) → java.awt.image.BufferedImage

get a screenshot of the display Autoplot's main UI is running within, but without the pointer.

### Returns:

a java.awt.image.BufferedImage
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getTrim

getTrim( java.io.File root, ProgressMonitor monitor ) → java.awt.Rectangle

return the common bounding rectangle to all png images in the directory.

### Parameters

root - folder containing png images.
monitor - progress monitor for the task

### Returns:

the rectangle common to all images.

### See Also:

getTrim(java.awt.image.BufferedImage)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getTrim

getTrim( java.awt.image.BufferedImage source ) → java.awt.Rectangle

return the rectangle containing the image. The background is determined by looking at the upper-left pixel, and the rectangle bounding the non-background pixels is returned. Thanks to http://stackoverflow.com/questions/10678015/how-to-auto-crop-an-image-white-border-in-java

### Parameters

source - the image, containing a base color in the upper right corner.

### Returns:

the rectangle tightly containing the windows.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## requestFinish

requestFinish( boolean trimAll ) → void

This was introduced to provide a method for Jemmy tests to record videos (so that videos are tested), but it looks like this won't work. However this would probably be useful from scripts, so I will leave it.

### Parameters

trimAll - trim off the portions of all screenshots which are not used.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## start

start( java.awt.Window parent ) → void

start should be called from the event thread.

### Parameters

parent - the device

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## takePicture

takePicture( int id ) → void

manually trigger a screenshot, which is put in the output directory.

### Parameters

id - user-provided id (≤ 99999) for the image, which is the last part of the filename.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## takePicture

takePicture( int id, String caption ) → void

manually trigger a screenshot, which is put in the output directory, and write a QC file to contain a caption.

### Parameters

id - user-provided id (≤ 99999) for the image, which is the last part of the filename.
caption - string caption.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## takePicture

takePicture( int id, String caption, java.awt.Component c, java.awt.Point p, int buttons ) → void

manually trigger a screenshot, which is put in the output directory, and write a QC file to contain a caption, and draw the pointer focused on the component.

### Parameters

id - user-provided id (≤ 99999) for the image, which is the last part of the filename.
caption - string caption.
c - component for controlling the mouse pointer location.
p - null or the point relative to the component.
buttons - MouseEvent.BUTTON1_DOWN_MASK

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## trim

trim( java.awt.image.BufferedImage image ) → java.awt.image.BufferedImage

trim off the excess white to make a smaller image

### Parameters

image - a BufferedImage

### Returns:

a java.awt.image.BufferedImage
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## trim

trim( java.awt.image.BufferedImage image, java.awt.Rectangle r ) → java.awt.image.BufferedImage

trim off the excess white to make a smaller image

### Parameters

image - the image
r - the rectangle

### Returns:

the smaller image
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## trimAll

trimAll( java.io.File dir ) → void

find the common trim bounding box and trim all the images in the directory.

### Parameters

dir - a File

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## trimAll

trimAll( java.io.File dir, java.awt.Rectangle r, ProgressMonitor monitor ) → void

find the common trim bounding box and trim all the images in the directory.

### Parameters

dir - folder containing the images.
r - the bounding rectangle, or null if getTrim should be used.
monitor - a ProgressMonitor

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]