com.teamdev.jxcapture
Class ImageCapture

java.lang.Object
  extended by com.teamdev.jxcapture.ImageCapture
Direct Known Subclasses:
LinuxImageCapture, MacOSImageCapture, WindowsImageCapture

public abstract class ImageCapture
extends java.lang.Object

Base class that defines the image capture API.


Field Summary
static java.lang.String PROPERTY_CAPTURE_AREA
           
static java.lang.String PROPERTY_CAPTURE_TRANSPARENT_WINDOWS
           
static java.lang.String PROPERTY_IMAGE_SOURCE
           
static java.lang.String PROPERTY_INCLUDE_CURSOR
           
 
Constructor Summary
protected ImageCapture()
          Creates new image capture.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add the specified property listener.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Add the specified property listener.
abstract  void copyToClipboard()
          Copies this capture to the system clipboard as a bitmap.
static ImageCapture create()
          Factory method that creates new instance of image capture instance depending on a current platform.
static ImageCapture create(ImageSource source)
          Factory method that creates new instance of image capture instance depending on a current platform and specified image source.
static ImageCapture create(com.teamdev.jxdesktop.UIElement element)
          Factory method that creates new instance of image capture instance depending on a current platform.
 java.awt.Rectangle getCaptureArea()
           
abstract  java.awt.image.BufferedImage getImage()
          Returns a Java image of this image capture.
 ImageSource getImageSource()
          Returns the specified video source.
protected  java.beans.PropertyChangeSupport getPropertyChangeSupport()
           
 boolean isCaptureTransparentWindows()
          Returns true if the capture operation allows to capture transparent or layered windows, otherwise - false.
 boolean isIncludeCursor()
          Determines whether the resulting image of the capture operation includes the cursor image.
abstract  void release()
          Releases all resources of this image capture.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove the specified property listener.
 ImageCapture resize(java.awt.Dimension dimensions)
          This method resizes this image capture using default interpolation mode InterpolationMode.Default
abstract  ImageCapture resize(java.awt.Dimension dimensions, InterpolationMode interpolation)
          Resizes this image capture to new dimensions using the specified interpolation mode.
 boolean save(java.io.File file, ImageFormat format)
          Saves this image capture to a file with the specified image format using the best compression quality.
abstract  boolean save(java.io.File file, ImageFormat format, CompressionQuality quality)
          Saves this image capture to a file with the specified image format.
 void setCaptureArea(java.awt.Rectangle area)
           
 void setCaptureTransparentWindows(boolean captureTransparentWindows)
          Sets true if the captureTransparentWindows operation should allow to captureTransparentWindows transparent or layered windows, otherwise - false.
 void setImageSource(ImageSource source)
          Specifies video source for recording.
 void setIncludeCursor(boolean includeCursor)
          Includes (or excludes) the cursor image to (or from) the resulting image of the capture operation.
abstract  ImageCapture takeSnapshot()
          Takes a snapshot of a specified capture area.
static java.awt.image.BufferedImage toBufferedImage(java.awt.Image image)
          Converts given image to buffered image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_IMAGE_SOURCE

public static final java.lang.String PROPERTY_IMAGE_SOURCE
See Also:
Constant Field Values

PROPERTY_CAPTURE_AREA

public static final java.lang.String PROPERTY_CAPTURE_AREA
See Also:
Constant Field Values

PROPERTY_INCLUDE_CURSOR

public static final java.lang.String PROPERTY_INCLUDE_CURSOR
See Also:
Constant Field Values

PROPERTY_CAPTURE_TRANSPARENT_WINDOWS

public static final java.lang.String PROPERTY_CAPTURE_TRANSPARENT_WINDOWS
See Also:
Constant Field Values
Constructor Detail

ImageCapture

protected ImageCapture()
Creates new image capture.

Method Detail

create

public static ImageCapture create()
Factory method that creates new instance of image capture instance depending on a current platform.

Returns:
image capture instance

create

public static ImageCapture create(com.teamdev.jxdesktop.UIElement element)
Factory method that creates new instance of image capture instance depending on a current platform.

Parameters:
element - defines UI element to capture
Returns:
image capture instance

create

public static ImageCapture create(ImageSource source)
Factory method that creates new instance of image capture instance depending on a current platform and specified image source.

Parameters:
source - image source
Returns:
image capture instance

takeSnapshot

public abstract ImageCapture takeSnapshot()
Takes a snapshot of a specified capture area. After taking snapshot the capture can be resized using the resize(java.awt.Dimension, InterpolationMode) method, or saved to the file using the save(java.io.File, com.teamdev.jxcapture.image.ImageFormat, CompressionQuality) method, or just returned as Java image using the getImage() method.

Returns:
this image capture object

getImage

public abstract java.awt.image.BufferedImage getImage()
Returns a Java image of this image capture.

Before calling this method you should invoke the takeSnapshot() method first.

Returns:
a buffered image

resize

public abstract ImageCapture resize(java.awt.Dimension dimensions,
                                    InterpolationMode interpolation)
Resizes this image capture to new dimensions using the specified interpolation mode.

Before calling this method you should invoke the takeSnapshot() method first.

Parameters:
dimensions - specifies new dimensions
interpolation - specifies interpolation mode
Returns:
return this image capture containing a transformed data

resize

public ImageCapture resize(java.awt.Dimension dimensions)
This method resizes this image capture using default interpolation mode InterpolationMode.Default

Before calling this method you should invoke the takeSnapshot() method first.

Parameters:
dimensions - specifies new dimensions
Returns:
return this image capture containing a transformed data

save

public abstract boolean save(java.io.File file,
                             ImageFormat format,
                             CompressionQuality quality)
                      throws java.io.IOException
Saves this image capture to a file with the specified image format.

Before calling this method you should invoke the takeSnapshot() method first.

Parameters:
file - destination file
format - required image format
quality - required compression quality of resulting image
Returns:
true if operation succeeds; false otherwise
Throws:
java.io.IOException - if any error occurs during the operation

save

public boolean save(java.io.File file,
                    ImageFormat format)
             throws java.io.IOException
Saves this image capture to a file with the specified image format using the best compression quality.

Before calling this method you should invoke the takeSnapshot() method first.

Parameters:
file - destination file
format - required image format
Returns:
true if operation succeeds; false otherwise
Throws:
java.io.IOException - if any error occurs during the operation

copyToClipboard

public abstract void copyToClipboard()
Copies this capture to the system clipboard as a bitmap.


release

public abstract void release()
Releases all resources of this image capture.


toBufferedImage

public static java.awt.image.BufferedImage toBufferedImage(java.awt.Image image)
Converts given image to buffered image.

Parameters:
image - image to convert
Returns:
buffered image

getImageSource

public ImageSource getImageSource()
Returns the specified video source.

Returns:
image source

setImageSource

public void setImageSource(ImageSource source)
Specifies video source for recording.

Parameters:
source - new video source

getPropertyChangeSupport

protected java.beans.PropertyChangeSupport getPropertyChangeSupport()

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Add the specified property listener.

Parameters:
propertyName - property name
listener - listener

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add the specified property listener.

Parameters:
listener - listener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove the specified property listener.

Parameters:
listener - listener

getCaptureArea

public java.awt.Rectangle getCaptureArea()
Returns:
specified capturing area

setCaptureArea

public void setCaptureArea(java.awt.Rectangle area)
Parameters:
area - required rectangular capture area

isIncludeCursor

public boolean isIncludeCursor()
Determines whether the resulting image of the capture operation includes the cursor image.

Returns:
true if the result of the capture operation includes the cursor image, false otherwise

setIncludeCursor

public void setIncludeCursor(boolean includeCursor)
Includes (or excludes) the cursor image to (or from) the resulting image of the capture operation.

Parameters:
includeCursor - If true, this cursor image is included into the result of the capture operation; otherwise not

isCaptureTransparentWindows

public boolean isCaptureTransparentWindows()
Returns true if the capture operation allows to capture transparent or layered windows, otherwise - false.

A layered or transparent window is used by some applications to create a fade-in/out effect for menus and windows. Layered windows are also used for desktop animation, such as animated help assistants.

Returns:
true if the capture transparent or layered window option is set, otherwise - false

setCaptureTransparentWindows

public void setCaptureTransparentWindows(boolean captureTransparentWindows)
Sets true if the captureTransparentWindows operation should allow to captureTransparentWindows transparent or layered windows, otherwise - false.

A layered or transparent window is used by some applications to create a fade-in/out effect for menus and windows. Layered windows are also used for desktop animation, such as animated help assistants.

Parameters:
captureTransparentWindows - true if the captureTransparentWindows operation should allow to captureTransparentWindows transparent or layered window, otherwise - false