Package org.testfx.service.support.impl
Class CaptureSupportImpl
- java.lang.Object
-
- org.testfx.service.support.impl.CaptureSupportImpl
-
- All Implemented Interfaces:
CaptureSupport
public class CaptureSupportImpl extends java.lang.Object implements CaptureSupport
-
-
Field Summary
Fields Modifier and Type Field Description private BaseRobotbaseRobotstatic CaptureFileFormatDEFAULT_FORMAT
-
Constructor Summary
Constructors Constructor Description CaptureSupportImpl(BaseRobot baseRobot)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.scene.image.ImageannotateImage(javafx.scene.shape.Shape shape, javafx.scene.image.Image image)NOT YET IMPLEMENTEDprivate javafx.scene.image.ImageblendImages(javafx.scene.image.Image image0, javafx.scene.image.Image image1, javafx.scene.effect.BlendMode blendMode, javafx.geometry.Pos alignment)javafx.scene.image.ImagecaptureNode(javafx.scene.Node node)Returns a snapshot of the node.javafx.scene.image.ImagecaptureRegion(javafx.geometry.Rectangle2D region)Returns a screenshot of the given region.private voidcheckFileExists(java.nio.file.Path path)private voidcheckParentDirectoryExists(java.nio.file.Path path)javafx.scene.image.ImageloadImage(java.nio.file.Path path)Loads the image file from the given path.PixelMatcherResultmatchImages(javafx.scene.image.Image image0, javafx.scene.image.Image image1, PixelMatcher pixelMatcher)Compares two images and returns aPixelMatcherResultthat defines the how similar/dissimilar one was from the other.private javafx.scene.image.ImagereadImageFromStream(java.io.InputStream inputStream)voidsaveImage(javafx.scene.image.Image image, java.nio.file.Path path)Saves the given image to the given path.voidsaveImage(javafx.scene.image.Image image, CaptureFileFormat format, java.nio.file.Path path)Saves the given image, with a provided fileformat to the given path.private javafx.scene.image.ImagesnapshotNodeToImage(javafx.scene.Node node)private voidwriteImageToStream(javafx.scene.image.Image image, java.lang.String imageFormat, java.io.OutputStream outputStream)
-
-
-
Field Detail
-
DEFAULT_FORMAT
public static final CaptureFileFormat DEFAULT_FORMAT
-
baseRobot
private final BaseRobot baseRobot
-
-
Constructor Detail
-
CaptureSupportImpl
public CaptureSupportImpl(BaseRobot baseRobot)
-
-
Method Detail
-
captureNode
public javafx.scene.image.Image captureNode(javafx.scene.Node node)
Description copied from interface:CaptureSupportReturns a snapshot of the node.- Specified by:
captureNodein interfaceCaptureSupport
-
captureRegion
public javafx.scene.image.Image captureRegion(javafx.geometry.Rectangle2D region)
Description copied from interface:CaptureSupportReturns a screenshot of the given region.- Specified by:
captureRegionin interfaceCaptureSupport
-
loadImage
public javafx.scene.image.Image loadImage(java.nio.file.Path path)
Description copied from interface:CaptureSupportLoads the image file from the given path.- Specified by:
loadImagein interfaceCaptureSupport
-
saveImage
public void saveImage(javafx.scene.image.Image image, java.nio.file.Path path)Description copied from interface:CaptureSupportSaves the given image to the given path.- Specified by:
saveImagein interfaceCaptureSupport
-
saveImage
public void saveImage(javafx.scene.image.Image image, CaptureFileFormat format, java.nio.file.Path path)Description copied from interface:CaptureSupportSaves the given image, with a provided fileformat to the given path.- Specified by:
saveImagein interfaceCaptureSupport
-
annotateImage
public javafx.scene.image.Image annotateImage(javafx.scene.shape.Shape shape, javafx.scene.image.Image image)Description copied from interface:CaptureSupportNOT YET IMPLEMENTED- Specified by:
annotateImagein interfaceCaptureSupport
-
matchImages
public PixelMatcherResult matchImages(javafx.scene.image.Image image0, javafx.scene.image.Image image1, PixelMatcher pixelMatcher)
Description copied from interface:CaptureSupportCompares two images and returns aPixelMatcherResultthat defines the how similar/dissimilar one was from the other.- Specified by:
matchImagesin interfaceCaptureSupport
-
checkFileExists
private void checkFileExists(java.nio.file.Path path)
-
checkParentDirectoryExists
private void checkParentDirectoryExists(java.nio.file.Path path)
-
snapshotNodeToImage
private javafx.scene.image.Image snapshotNodeToImage(javafx.scene.Node node)
-
readImageFromStream
private javafx.scene.image.Image readImageFromStream(java.io.InputStream inputStream) throws java.io.IOException- Throws:
java.io.IOException
-
writeImageToStream
private void writeImageToStream(javafx.scene.image.Image image, java.lang.String imageFormat, java.io.OutputStream outputStream) throws java.io.IOException- Throws:
java.io.IOException
-
blendImages
private javafx.scene.image.Image blendImages(javafx.scene.image.Image image0, javafx.scene.image.Image image1, javafx.scene.effect.BlendMode blendMode, javafx.geometry.Pos alignment)
-
-