com.teamdev.jxcapture.image.win
Class WindowsImageCapture

java.lang.Object
  extended by com.teamdev.jxcapture.ImageCapture
      extended by com.teamdev.jxcapture.image.win.WindowsImageCapture

public class WindowsImageCapture
extends ImageCapture

A collection of utility methods for the Windows desktop.


Field Summary
static java.lang.String PROPERTY_CAPTURE_AREA
           
static java.lang.String PROPERTY_CAPTURE_TRANSPARENT_WINDOWS
           
static java.lang.String PROPERTY_INCLUDE_CURSOR
           
 
Fields inherited from class com.teamdev.jxcapture.ImageCapture
PROPERTY_IMAGE_SOURCE
 
Constructor Summary
WindowsImageCapture()
           
 
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.
 void copyToClipboard()
          Copies this capture to the system clipboard as a bitmap.
static void enableDwmComposition(boolean enable)
          Allows to enable or disable Desktop Window Manager (DWM) composition.
 java.awt.Rectangle getCaptureArea()
           
 java.awt.image.BufferedImage getImage()
          Returns a Java image of this image capture.
protected  java.beans.PropertyChangeSupport getPropertyChangeSupport()
           
 boolean isCaptureTransparentWindows()
          Returns true if the capture operation allows to capture transparent or layered windows, otherwise - false.
static boolean isDwmCompositionEnabled()
          Allows to check if Desktop Window Manager (DWM) composition is enabled.
 boolean isIncludeCursor()
          Determines whether the resulting image of the capture operation includes the cursor image.
 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, InterpolationMode interpolation)
          Resizes this image capture to new dimensions using the specified interpolation mode.
 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 setIncludeCursor(boolean includeCursor)
          Includes (or excludes) the cursor image to (or from) the resulting image of the capture operation.
 ImageCapture takeSnapshot()
          Takes a snapshot of a specified capture area.
 
Methods inherited from class com.teamdev.jxcapture.ImageCapture
create, create, create, getImageSource, resize, save, setImageSource, toBufferedImage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

WindowsImageCapture

public WindowsImageCapture()
Method Detail

enableDwmComposition

public static void enableDwmComposition(boolean enable)
Allows to enable or disable Desktop Window Manager (DWM) composition.

Parameters:
enable - true - enables composition; false disables it

isDwmCompositionEnabled

public static boolean isDwmCompositionEnabled()
Allows to check if Desktop Window Manager (DWM) composition is enabled.

Returns:
true if dwm is enabled, false otherwise

takeSnapshot

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

Specified by:
takeSnapshot in class ImageCapture
Returns:
this image capture object

getImage

public java.awt.image.BufferedImage getImage()
Description copied from class: ImageCapture
Returns a Java image of this image capture.

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

Specified by:
getImage in class ImageCapture
Returns:
a buffered image

resize

public ImageCapture resize(java.awt.Dimension dimensions,
                           InterpolationMode interpolation)
Description copied from class: ImageCapture
Resizes this image capture to new dimensions using the specified interpolation mode.

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

Specified by:
resize in class ImageCapture
Parameters:
dimensions - specifies new dimensions
interpolation - specifies interpolation mode
Returns:
return this image capture containing a transformed data

save

public boolean save(java.io.File file,
                    ImageFormat format,
                    CompressionQuality quality)
Description copied from class: ImageCapture
Saves this image capture to a file with the specified image format.

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

Specified by:
save in class ImageCapture
Parameters:
file - destination file
format - required image format
quality - required compression quality of resulting image
Returns:
true if operation succeeds; false otherwise

copyToClipboard

public void copyToClipboard()
Description copied from class: ImageCapture
Copies this capture to the system clipboard as a bitmap.

Specified by:
copyToClipboard in class ImageCapture

release

public void release()
Description copied from class: ImageCapture
Releases all resources of this image capture.

Specified by:
release in class ImageCapture

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