Class ScreenImage


  • public class ScreenImage
    extends Image
    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)
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.sikuli.script.Element

        org.sikuli.script.Element.Interpolation
    • Field Summary

      Fields 
      Modifier and Type Field Description
      Location end  
      Location start  
      • Fields inherited from class org.sikuli.script.Element

        h, w, x, y
    • Constructor Summary

      Constructors 
      Constructor Description
      ScreenImage​(java.awt.Rectangle roi, java.awt.image.BufferedImage img)
      create ScreenImage with given
      ScreenImage​(java.io.File shotFile)
      create ScreenImage from given
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)  
      java.awt.image.BufferedImage getBufferedImage()  
      org.opencv.core.Mat getContent()  
      Location getEnd()  
      java.lang.String getFile​(java.lang.String path)
      stores the image as PNG file in the given path with a created filename (sikuliximage-timestamp.png)
      java.lang.String getFile​(java.lang.String path, java.lang.String name)
      stores the image as PNG file in the given path with the given filename
      java.lang.String getFilename()
      Deprecated.
      use save() instead
      Region getRegion()  
      java.awt.Rectangle getROI()  
      Location getStart()  
      java.lang.String getStoredAt()  
      ScreenImage getSub​(java.awt.Rectangle sub)  
      org.opencv.core.Mat makeMat()  
      java.lang.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
      java.lang.String save​(java.lang.String name)  
      java.lang.String saveInto​(java.io.File path)  
      java.lang.String saveInto​(java.lang.String path)
      stores the image as PNG file in the given path with a created filename (sikuliximage-timestamp.png)
      void saveLastScreenImage​(java.io.File fPath)  
      void setStartEnd​(Location start, Location end)  
      • Methods inherited from class org.sikuli.script.Element

        asFakeImage, asMaskImage, asText, black, black, cacheStats, click, click, click, cloneContent, collectLines, collectLinesText, collectWords, collectWordsText, createURL, createURL, delayClick, diffPercentage, exists, exists, existsT, existsText, file, fileName, find, findAll, findAllByColumn, findAllByRow, findAllT, findAllText, findAny, findAnyList, findBest, findBestList, findChanges, findLine, findLines, findLines, findT, findText, findWord, findWords, findWords, getAll, getAutoWaitTimeout, getBufferedImage, getCache, getCenter, getFindFailedHandler, getFindFailedResponse, getH, getImage, getImage, getLastMatch, getLastMatches, getMatchLastSeen, getName, getObserveScanRate, getOtherScreen, getPoint, getRect, getRepeatWaitTime, getScreen, getSize, getTarget, getThrowException, getValidImageFilename, getW, getWaitScanRate, getX, getY, has, has, hasT, hasText, hasURL, hover, hover, ignoreLastSeen, initScreen, intersection, isFakeImage, isInside, isMaskImage, isOtherScreen, isText, isValid, isVirtual, match, match, matches, matches, mean, meanColor, mouseDown, mouseMove, mouseMove, mouseMove, mouseUp, mouseUp, plain, plain, reload, reload, reLocate, resetCache, resetFindFailedResponse, resetThrowException, resize, resize, sameSize, save, save, set, set, setAutoWaitTimeout, setCenter, setContent, setFindFailedHandler, setFindFailedResponse, setH, setLocation, setMissingAbort, setMissingPrompt, setName, setObserveScanRate, setOtherScreen, setRect, setRect, setRect, setRepeatWaitTime, setScreen, setThrowException, setVirtual, setW, setWaitScanRate, setX, setX, setY, setY, size, size, stdDev, text, textChar, textLine, textLines, textWord, textWords, toString, traceOff, traceOn, union, unionAll, unionAny, unionAnyList, updateContent, url, url, url, virtual, wait, wait, wait, waitVanish, waitVanish, white
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ScreenImage

        public ScreenImage​(java.awt.Rectangle roi,
                           java.awt.image.BufferedImage img)
        create ScreenImage with given
        Parameters:
        roi - the rectangle it was taken from
        img - the BufferedImage
      • ScreenImage

        public ScreenImage​(java.io.File shotFile)
        create ScreenImage from given
        Parameters:
        shotFile - previously saved screenshot
    • Method Detail

      • getContent

        public org.opencv.core.Mat getContent()
        Overrides:
        getContent in class org.sikuli.script.Element
      • getBufferedImage

        public java.awt.image.BufferedImage getBufferedImage()
        Overrides:
        getBufferedImage in class org.sikuli.script.Element
        Returns:
        the stored image in memory
      • makeMat

        public org.opencv.core.Mat makeMat()
      • getRegion

        public Region getRegion()
        Returns:
        the Region, the iamge was created from
      • getROI

        public java.awt.Rectangle getROI()
        Returns:
        the screen rectangle, the iamge was created from
      • getSub

        public ScreenImage getSub​(java.awt.Rectangle sub)
      • saveInto

        public java.lang.String saveInto​(java.lang.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
      • saveInto

        public java.lang.String saveInto​(java.io.File path)
      • save

        public java.lang.String save​(java.lang.String name)
        Overrides:
        save in class org.sikuli.script.Element
      • getFile

        public java.lang.String getFile​(java.lang.String path,
                                        java.lang.String name)
        stores the image as PNG file in the given path with the given filename
        Parameters:
        path - valid path string
        name - filename (.png is added if not present)
        Returns:
        absolute path to stored file
      • getFilename

        @Deprecated
        public java.lang.String getFilename()
        Deprecated.
        use save() instead
        creates the PNG tempfile only when needed.
        Overrides:
        getFilename in class Image
        Returns:
        absolute path to stored tempfile
      • getStoredAt

        public java.lang.String getStoredAt()
      • save

        public java.lang.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 java.lang.String getFile​(java.lang.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
      • saveLastScreenImage

        public void saveLastScreenImage​(java.io.File fPath)
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object