public abstract class AbstractImagePattern extends Object
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Constructor and Description |
---|
AbstractImagePattern() |
Modifier and Type | Method and Description |
---|---|
Vector |
findPattern(int[] source,
Rectangle sourceRect,
int maxHitCount,
float passRate)
Look for occurrences of a pattern in the given array of pixels.
|
int |
getNumberOfNonAlphaPixels()
Get the number of translucent or transparent pixels.
|
int[] |
getPixels()
Get the pattern pixels.
|
Rectangle |
getRectangle()
Get the pattern rectangle.
|
String |
getStampAsString()
Convert the pattern to a customary String format.It is not currently used
and this method is reserved for future use.
|
abstract String |
getType()
Get the pattern type.
|
boolean |
isStopped()
Tests out if image comparison has been stopped (or the stop has been
requested).
|
abstract boolean |
matches(int[] source,
int offset,
Rectangle sourceRect,
float passRate)
Find out if the pattern matches with source pixels at a specified offset.
|
void |
parseStampFromString(String s)
Load pattern pixels from a string.This method is not currently used and
it is reserved for future use.
|
void |
setPixels(int[] pixels,
Rectangle r)
Set the pixels of the pattern directly.
|
boolean |
setPixelsFromImage(Image img,
Rectangle r)
Load the pattern pixels from a certain rectangle of an image.
|
void |
stop()
Stop image comparison.
|
String |
toString()
Get details of this pattern as a String.If the pattern has less than 20
pixels, they are also included in the customary format specified by the
getStampAsString() method. |
public void stop()
public boolean isStopped()
public abstract String getType()
public abstract boolean matches(int[] source, int offset, Rectangle sourceRect, float passRate)
source
- source pixels (usually pixels of a certain area of the
remote desktop image)offset
- from which pixel array index to comparesourceRect
- rectangle identifying the area from to which the source
pixels belong topassRate
- the pass rate between 0 and 1.public void setPixels(int[] pixels, Rectangle r)
pixels
- pattern pixelsr
- pattern rectanglepublic int[] getPixels()
public Rectangle getRectangle()
public boolean setPixelsFromImage(Image img, Rectangle r)
img
- an image to load the pixels from.r
- a rectangle to load the pixels from. The rectangle must not be
bigger than the image size.public String getStampAsString()
public void parseStampFromString(String s)
s
- a pattern converted to a String using
getStampAsString()
.public Vector findPattern(int[] source, Rectangle sourceRect, int maxHitCount, float passRate)
source
- an array of pixels representing an image.sourceRect
- geometry (rectangle) of the image.maxHitCount
- maximum number of hits. Once the number is reached,
searching stops.passRate
- the pass rate between 0 and 1.public String toString()
getStampAsString()
method.public int getNumberOfNonAlphaPixels()