Package org.sikuli.script
Class Pattern
- java.lang.Object
- 
- org.sikuli.script.Pattern
 
- 
 public class Pattern extends java.lang.Objectto define a more complex search target
 - non-standard minimum similarity
 - click target other than center
 - masked image (ignore transparent pixels) - resize in case of different environment (scaled views) - wait after used in actions like clickNOTE: Pattern is a candidate for deprecation in the long run and will be substituted by Image 
- 
- 
Constructor SummaryConstructors Constructor Description Pattern(PSUFEBM what)Create a Pattern from various sources.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Patternexact()sets the minimum Similarity to 0.99 which means exact matchjava.awt.image.BufferedImagegetBImage()java.lang.StringgetFilename()the current image's absolute filepath
 will return null, if image is in jar or in webImagegetImage()ImagegetMask()floatgetResize()doublegetSimilar()LocationgetTargetOffset()booleanhasMask()booleanisValid()static Patternmake(Image img, double sim, Location off, float rFactor, java.lang.String mask)<SUFEBMP> Patternmask(SUFEBMP what)Patternresize(float factor)PatternsetFilename(java.lang.String fileName)set a new image for this patternvoidsetMaskFromString(java.lang.String mask)Patternsimilar(double sim)sets the minimum Similarity to use with findXPatterntargetOffset(int dx, int dy)set the offset from the match's center to be used with mouse actionsPatterntargetOffset(Location loc)set the offset from the match's center to be used with mouse actionsjava.lang.StringtoString()intwaitAfter()Get the value of waitAfterPatternwaitAfter(int waitAfter)Set the value of waitAfter
 
- 
- 
- 
Constructor Detail- 
Patternpublic Pattern(PSUFEBM what) Create a Pattern from various sources.- from another pattern with all attributes - from a file (String, URL, File) - from an image Element- from a BufferedImage or OpenCV Mat- Type Parameters:
- PSUFEBM- see source variants
- Parameters:
- what- the source
 
 
- 
 - 
Method Detail- 
makepublic static Pattern make(Image img, double sim, Location off, float rFactor, java.lang.String mask) 
 - 
isValidpublic boolean isValid() 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
resizepublic Pattern resize(float factor) 
 - 
getResizepublic float getResize() 
 - 
maskpublic <SUFEBMP> Pattern mask(SUFEBMP what) 
 - 
hasMaskpublic boolean hasMask() 
 - 
getMaskpublic Image getMask() 
 - 
setMaskFromStringpublic void setMaskFromString(java.lang.String mask) 
 - 
getImagepublic Image getImage() 
 - 
getBImagepublic java.awt.image.BufferedImage getBImage() 
 - 
setFilenamepublic Pattern setFilename(java.lang.String fileName) set a new image for this pattern- Parameters:
- fileName- image filename
- Returns:
- the Pattern itself
 
 - 
getFilenamepublic java.lang.String getFilename() the current image's absolute filepath
 will return null, if image is in jar or in web- Returns:
- might be null
 
 - 
similarpublic Pattern similar(double sim) sets the minimum Similarity to use with findX- Parameters:
- sim- value 0 to 1
- Returns:
- the Pattern object itself
 
 - 
exactpublic Pattern exact() sets the minimum Similarity to 0.99 which means exact match- Returns:
- the Pattern object itself
 
 - 
getSimilarpublic double getSimilar() - Returns:
- the current minimum similarity
 
 - 
targetOffsetpublic Pattern targetOffset(int dx, int dy) set the offset from the match's center to be used with mouse actions- Parameters:
- dx- x offset
- dy- y offset
- Returns:
- the Pattern object itself
 
 - 
targetOffsetpublic Pattern targetOffset(Location loc) set the offset from the match's center to be used with mouse actions- Parameters:
- loc- Location
- Returns:
- the Pattern object itself
 
 - 
getTargetOffsetpublic Location getTargetOffset() 
 - 
waitAfterpublic int waitAfter() Get the value of waitAfter- Returns:
- the value of waitAfter
 
 - 
waitAfterpublic Pattern waitAfter(int waitAfter) Set the value of waitAfter- Parameters:
- waitAfter- new value of waitAfter
- Returns:
- the image
 
 
- 
 
-