public abstract class Snapshot<T extends Snapshot> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected BufferedImage |
image |
| Constructor and Description |
|---|
Snapshot() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(BufferedImage image) |
boolean |
equals(BufferedImage image,
double deviation) |
boolean |
equals(Object o) |
boolean |
equals(Snapshot other,
double deviation) |
boolean |
equals(String path) |
boolean |
equals(String path,
double deviation) |
boolean |
equalsWithDiff(BufferedImage image,
String resultingImagePath) |
boolean |
equalsWithDiff(BufferedImage image,
String resultingImagePath,
double deviation) |
boolean |
equalsWithDiff(Snapshot image,
String resultingImagePath) |
boolean |
equalsWithDiff(Snapshot image,
String resultingImagePath,
double deviation) |
boolean |
equalsWithDiff(String path,
String resultingImagePath) |
boolean |
equalsWithDiff(String path,
String resultingImagePath,
double deviation) |
byte[] |
getBytes() |
BufferedImage |
getImage() |
int |
hashCode() |
T |
monochrome()
Apply gray-and-white filter to the image.
|
void |
save()
Final method to be called in the chain.
|
void |
save(String path)
Final method to be called in the chain.
|
protected abstract T |
self() |
protected void |
setImage(BufferedImage image) |
T |
withCroppedThumbnail(double scale,
double cropWidth,
double cropHeight)
Generate cropped thumbnail of the original screenshot.
|
T |
withCroppedThumbnail(double scale,
int maxWidth,
int maxHeight)
Generate cropped thumbnail of the original screenshot.
|
T |
withCroppedThumbnail(String path,
String name,
double scale,
double cropWidth,
double cropHeight)
Generate cropped thumbnail of the original screenshot.
|
T |
withCroppedThumbnail(String path,
String name,
double scale,
int maxWidth,
int maxHeight)
Generate cropped thumbnail of the original screenshot.
|
T |
withName(String name) |
T |
withThumbnail(double scale)
Generate a thumbnail of the original screenshot.
|
T |
withThumbnail(Path path,
String name,
double scale)
Generate a thumbnail of the original screenshot.
|
T |
withThumbnail(String path,
String name,
double scale)
Generate a thumbnail of the original screenshot.
|
T |
withTitle(String title) |
protected BufferedImage image
protected abstract T self()
public T withName(String name)
name - file name of the resulted image
by default will be timestamp in format: 'yyyy_MM_dd_HH_mm_ss_SSS'.public T withTitle(String title)
title - title of the resulted image.
Won't be assigned by default.public T withThumbnail(String path, String name, double scale)
path - to save thumbnail image toname - of the resulting imagescale - to applypublic T withCroppedThumbnail(String path, String name, double scale, double cropWidth, double cropHeight)
path - to save thumbnail image toname - of the resulting imagescale - to applycropWidth - e.g. 0.2 will leave 20% of the initial widthcropHeight - e.g. 0.1 will leave 10% of the initial widthpublic T withCroppedThumbnail(String path, String name, double scale, int maxWidth, int maxHeight)
path - to save thumbnail image toname - of the resulting imagescale - to applymaxWidth - max width in pixels. If set to -1 the actual image width is usedmaxHeight - max height in pixels. If set to -1 the actual image height is usedpublic T withCroppedThumbnail(double scale, double cropWidth, double cropHeight)
scale - to applycropWidth - e.g. 0.2 will leave 20% of the initial widthcropHeight - e.g. 0.1 will leave 10% of the initial widthpublic T withCroppedThumbnail(double scale, int maxWidth, int maxHeight)
scale - to applymaxWidth - max width in pixels. If set to -1 the actual image width is usedmaxHeight - max height in pixels. If set to -1 the actual image height is usedpublic T withThumbnail(Path path, String name, double scale)
path - to save thumbnail image toname - of the resulting imagescale - to applypublic T withThumbnail(double scale)
scale - to applypublic T monochrome()
public BufferedImage getImage()
public byte[] getBytes()
throws IOException
IOExceptionprotected void setImage(BufferedImage image)
public void save()
public void save(String path)
path - to save image topublic boolean equals(Snapshot other, double deviation)
other - Snapshot to compare withdeviation - allowed deviation while comparing.public boolean equals(Object o)
public boolean equals(BufferedImage image)
image - BufferedImage to compare with.public boolean equals(String path) throws IOException
path - path to image to compare to.IOException - if unable to read image from pathpublic boolean equals(BufferedImage image, double deviation)
image - BufferedImage to compare with.deviation - allowed deviation while comparing.public boolean equals(String path, double deviation) throws IOException
path - path to image to compare to.deviation - allowed deviation while comparing.IOException - if unable to read image from pathpublic boolean equalsWithDiff(BufferedImage image, String resultingImagePath)
image - BufferedImage to compare with.resultingImagePath - path with name to save to resulting images with diffpublic boolean equalsWithDiff(BufferedImage image, String resultingImagePath, double deviation)
image - BufferedImage to compare with.resultingImagePath - path with name to save to resulting images with diffdeviation - allowed deviation while comparingpublic boolean equalsWithDiff(Snapshot image, String resultingImagePath)
image - Snapshot to compare with.resultingImagePath - path with name to save to resulting images with diffpublic boolean equalsWithDiff(Snapshot image, String resultingImagePath, double deviation)
image - Snapshot to compare with.resultingImagePath - path with name to save to resulting images with diffdeviation - allowed deviation while comparingpublic boolean equalsWithDiff(String path, String resultingImagePath) throws IOException
path - path to image to compare toresultingImagePath - path with name to save to resulting images with diffIOException - if unable to read image from pathpublic boolean equalsWithDiff(String path, String resultingImagePath, double deviation) throws IOException
path - BufferedImage to compare with.resultingImagePath - path with name to save to resulting images with diffdeviation - allowed deviation while comparingIOException - if unable to read image from pathCopyright © 2020. All rights reserved.