public class SmallPieceComparator
extends java.lang.Thread
This class provides a way of multi-thread to search an image on screen, or to search an image on a bigger image. The algorithm is different according to the size of the image to search. If the size is big: We will divide the image into small blocks, for each block, we use this class to create a thread to search it on screen from a fixed-start-point. If the size is small: We will divide the search rectangle to small blocks, for each small search rectangle, we use this class to create a thread to search the whole image on screen from a changable-start-point (each point in the small search rectangle will be tried as a start point until the image is found)
| Constructor and Description |
|---|
SmallPieceComparator() |
SmallPieceComparator(java.awt.image.BufferedImage screenImage,
java.awt.image.BufferedImage targetImage,
SharedLock lock,
java.awt.Rectangle block,
int screenStartx,
int screenEndx,
int screenStarty,
int screenEndy,
boolean moveScreenStartPoint)
SmallPieceComparator Constructor.
|
SmallPieceComparator(java.awt.image.BufferedImage screenImage,
java.awt.image.BufferedImage targetImage,
SharedLock lock,
java.awt.Rectangle block,
int screenStartx,
int screenEndx,
int screenStarty,
int screenEndy,
boolean moveScreenStartPoint,
boolean fuzzyMatching)
SmallPieceComparator Constructor.
|
SmallPieceComparator(java.awt.image.DataBuffer screenshotBuffer,
java.awt.image.SampleModel screenshot,
java.awt.image.DataBuffer targetBuffer,
java.awt.image.SampleModel target,
SharedLock lock,
java.awt.Rectangle block,
int screenStartx,
int screenEndx,
int screenStarty,
int screenEndy,
boolean moveScreenStartPoint)
SmallPieceComparator Constructor.
NOTE: Be careful with DataBuffer and SampleModel parameters, sometimes they are bigger than the image itself and have an offset to show the begining point. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isInterrupted() |
void |
run() |
void |
setInterrupted(boolean interrupted) |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldpublic SmallPieceComparator()
public SmallPieceComparator(java.awt.image.BufferedImage screenImage,
java.awt.image.BufferedImage targetImage,
SharedLock lock,
java.awt.Rectangle block,
int screenStartx,
int screenEndx,
int screenStarty,
int screenEndy,
boolean moveScreenStartPoint)
screenImage - BufferedImage, the screen image within which to find the target image.targetImage - BufferedImage, the target image to find in the screen.lock - SharedLock, the lock used to synchronize between main thread and search-thread.block - Rectangle, a piece of targetImage or a piece of search-rectangle on screen.screenStartx - int, the x-coordinate of start-search-pointscreenEndx - int, the y-coordinate of start-search-pointscreenStarty - int, the x-coordinate of end-search-pointscreenEndy - int, the y-coordinate of end-search-pointmoveScreenStartPoint - boolean, see moveScreenStartPointpublic SmallPieceComparator(java.awt.image.BufferedImage screenImage,
java.awt.image.BufferedImage targetImage,
SharedLock lock,
java.awt.Rectangle block,
int screenStartx,
int screenEndx,
int screenStarty,
int screenEndy,
boolean moveScreenStartPoint,
boolean fuzzyMatching)
screenImage - BufferedImage, the screen image within which to find the target image.targetImage - BufferedImage, the target image to find in the screen.lock - SharedLock, the lock used to synchronize between main thread and search-thread.block - Rectangle, a piece of targetImage or a piece of search-rectangle on screen.screenStartx - int, the x-coordinate of start-search-pointscreenEndx - int, the y-coordinate of start-search-pointscreenStarty - int, the x-coordinate of end-search-pointscreenEndy - int, the y-coordinate of end-search-pointmoveScreenStartPoint - boolean, see moveScreenStartPointfuzzyMatching - boolean, if we can use fuzzy-matching-algorithm to match a pixel.public SmallPieceComparator(java.awt.image.DataBuffer screenshotBuffer,
java.awt.image.SampleModel screenshot,
java.awt.image.DataBuffer targetBuffer,
java.awt.image.SampleModel target,
SharedLock lock,
java.awt.Rectangle block,
int screenStartx,
int screenEndx,
int screenStarty,
int screenEndy,
boolean moveScreenStartPoint)
ImageUtils.copy(BufferedImage) and use thescreenshotBuffer - DataBuffer, the databuffer of the screen image within which to find the target image.screenshot - SampleModel, the sample-model the screen image within which to find the target image.targetBuffer - DataBuffer, the databuffer of the target image to find in the screen.target - SampleModel, the sample-model of the target image to find in the screen.lock - SharedLock, the lock used to synchronize between main thread and search-thread.block - Rectangle, a piece of targetImage or a piece of search-rectangle on screen.screenStartx - int, the x-coordinate of start-search-pointscreenEndx - int, the y-coordinate of start-search-pointscreenStarty - int, the x-coordinate of end-search-pointscreenEndy - int, the y-coordinate of end-search-pointmoveScreenStartPoint - boolean, see moveScreenStartPointCopyright © SAS Institute. All Rights Reserved.