Package org.netbeans.jemmy.util
Class PNGEncoder
java.lang.Object
org.netbeans.jemmy.util.PNGEncoder
This class allows to encode BufferedImage into B/W, greyscale or true color PNG
image format with maximum compression.
It also provides complete functionality for capturing full screen, part of screen or single component, encoding and saving captured image info PNG file.
It also provides complete functionality for capturing full screen, part of screen or single component, encoding and saving captured image info PNG file.
- Version:
- 1.0
- Author:
- Adam Sotona
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
black and white image mode.static final byte
full color image mode.static final byte
grey scale image mode. -
Constructor Summary
ConstructorsConstructorDescriptionPNGEncoder
(OutputStream out) public constructor of PNGEncoder class with greyscale mode by default.PNGEncoder
(OutputStream out, byte mode) public constructor of PNGEncoder class. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
captureScreen
(Component comp, String fileName) Static method performing one component screen capture into PNG image format file with given fileName.static void
captureScreen
(Component comp, String fileName, byte mode) Static method performing one component screen capture into PNG image format file with given fileName.static void
captureScreen
(Rectangle rect, String fileName) Static method performing screen capture into PNG image format file with given fileName.static void
captureScreen
(Rectangle rect, String fileName, byte mode) Static method performing screen capture into PNG image format file with given fileName.static void
captureScreen
(String fileName) Static method performing whole screen capture into PNG image format file with given fileName.static void
captureScreen
(String fileName, byte mode) Static method performing whole screen capture into PNG image format file with given fileName.void
encode
(BufferedImage image) main encoding method (stays blocked till encoding is finished).
-
Field Details
-
BW_MODE
public static final byte BW_MODEblack and white image mode.- See Also:
-
GREYSCALE_MODE
public static final byte GREYSCALE_MODEgrey scale image mode.- See Also:
-
COLOR_MODE
public static final byte COLOR_MODEfull color image mode.- See Also:
-
-
Constructor Details
-
PNGEncoder
public constructor of PNGEncoder class with greyscale mode by default.- Parameters:
out
- output stream for PNG image format to write into
-
PNGEncoder
public constructor of PNGEncoder class.- Parameters:
out
- output stream for PNG image format to write intomode
- BW_MODE, GREYSCALE_MODE or COLOR_MODE
-
-
Method Details
-
encode
main encoding method (stays blocked till encoding is finished).- Parameters:
image
- BufferedImage to encode- Throws:
IOException
- IOException
-
captureScreen
Static method performing screen capture into PNG image format file with given fileName.- Parameters:
rect
- Rectangle of screen to be capturedfileName
- file name for screen capture PNG image file
-
captureScreen
Static method performing screen capture into PNG image format file with given fileName.- Parameters:
rect
- Rectangle of screen to be capturedmode
- image color modefileName
- file name for screen capture PNG image file
-
captureScreen
Static method performing one component screen capture into PNG image format file with given fileName.- Parameters:
comp
- Component to be capturedfileName
- String image target filename
-
captureScreen
Static method performing one component screen capture into PNG image format file with given fileName.- Parameters:
comp
- Component to be capturedfileName
- String image target filenamemode
- image color mode
-
captureScreen
Static method performing whole screen capture into PNG image format file with given fileName.- Parameters:
fileName
- String image target filename
-
captureScreen
Static method performing whole screen capture into PNG image format file with given fileName.- Parameters:
fileName
- String image target filenamemode
- image color mode
-