Package org.sikuli.script
Class ScreenImage
- java.lang.Object
-
- org.sikuli.script.ScreenImage
-
public class ScreenImage extends Object
CANDIDATE FOR DEPRECATION stores a BufferedImage usually ceated by screen capture, the screen rectangle it was taken from and the filename, where it is stored as PNG (only if requested) This will be replaced by Image in the long run
-
-
Field Summary
Fields Modifier and Type Field Description protected String_filenameprotected BufferedImage_imgprotected Rectangle_roiLocationendinthx, y, w, h of the stored ROILocationstartintwx, y, w, h of the stored ROIintxx, y, w, h of the stored ROIintyx, y, w, h of the stored ROI
-
Constructor Summary
Constructors Constructor Description ScreenImage(Rectangle roi, BufferedImage img)create ScreenImage with given
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(Object other)LocationgetEnd()StringgetFile()INTERNAL USE: use getTimedFile() insteadStringgetFile(String path)stores the image as PNG file in the given path with a created filename (sikuliximage-timestamp.png)StringgetFile(String path, String name)stores the image as PNG file in the given path with the given filenameStringgetFilename()Deprecated.use getFile() insteadBufferedImagegetImage()RegiongetRegion()RectanglegetROI()LocationgetStart()StringgetStoredAt()ScreenImagegetSub(Rectangle sub)Stringsave()stores the image as PNG file in the standard temp folder with a created filename (sikuliximage-timestamp.png) if not yet stored beforeStringsave(String path)stores the image as PNG file in the given path with a created filename (sikuliximage-timestamp.png)Stringsave(String path, String name)stores the image as PNG file in the given path with a created filename (givenName-timestamp.png)StringsaveInBundle(String name)voidsaveLastScreenImage(File fPath)voidsetStartEnd(Location start, Location end)
-
-
-
Field Detail
-
x
public int x
x, y, w, h of the stored ROI
-
y
public int y
x, y, w, h of the stored ROI
-
w
public int w
x, y, w, h of the stored ROI
-
h
public int h
x, y, w, h of the stored ROI
-
_roi
protected Rectangle _roi
-
_img
protected BufferedImage _img
-
_filename
protected String _filename
-
start
public Location start
-
end
public Location end
-
-
Constructor Detail
-
ScreenImage
public ScreenImage(Rectangle roi, BufferedImage img)
create ScreenImage with given- Parameters:
roi- the rectangle it was taken fromimg- the BufferedImage
-
-
Method Detail
-
getStart
public Location getStart()
-
getEnd
public Location getEnd()
-
getSub
public ScreenImage getSub(Rectangle sub)
-
getFilename
@Deprecated public String getFilename() throws IOException
Deprecated.use getFile() insteadcreates the PNG tempfile only when needed.- Returns:
- absolute path to stored tempfile
- Throws:
IOException- if not found
-
getFile
public String getFile()
INTERNAL USE: use getTimedFile() instead- Returns:
- absolute path to stored file
-
getStoredAt
public String getStoredAt()
-
save
public String save()
stores the image as PNG file in the standard temp folder with a created filename (sikuliximage-timestamp.png) if not yet stored before- Returns:
- absolute path to stored file
-
getFile
public String getFile(String path)
stores the image as PNG file in the given path with a created filename (sikuliximage-timestamp.png)- Parameters:
path- valid path string- Returns:
- absolute path to stored file
-
save
public String save(String path)
stores the image as PNG file in the given path with a created filename (sikuliximage-timestamp.png)- Parameters:
path- valid path string- Returns:
- absolute path to stored file
-
save
public String save(String path, String name)
stores the image as PNG file in the given path with a created filename (givenName-timestamp.png)- Parameters:
path- valid path stringname- file name- Returns:
- absolute path to stored file
-
getFile
public String getFile(String path, String name)
stores the image as PNG file in the given path with the given filename- Parameters:
path- valid path stringname- filename (.png is added if not present)- Returns:
- absolute path to stored file
-
getImage
public BufferedImage getImage()
- Returns:
- the stored image in memory
-
getRegion
public Region getRegion()
- Returns:
- the Region, the iamge was created from
-
getROI
public Rectangle getROI()
- Returns:
- the screen rectangle, the iamge was created from
-
saveLastScreenImage
public void saveLastScreenImage(File fPath)
-
-