add find image by path

This commit is contained in:
vcaesar 2018-04-09 17:34:02 +08:00
parent 26e0b82abc
commit b99914bc5e

View File

@ -809,6 +809,32 @@ func FindBitmap(args ...interface{}) (int, int) {
return int(pos.x), int(pos.y) return int(pos.x), int(pos.y)
} }
// FindPic finding the image by path
func FindPic(path string, args...interface{})(int, int){
var (
sbit C.MMBitmapRef
tolerance float64
)
openbit := OpenBitmap(path)
if len(args) > 0 {
sbit = args[0].(C.MMBitmapRef)
} else {
sbit = CaptureScreen()
}
if len(args) > 1 {
tolerance = args[1].(float64)
} else {
tolerance = 0.5
}
fx, fy := FindBitmap(openbit, sbit, tolerance)
return fx,fy
}
// FindEveryBitmap find the every bitmap // FindEveryBitmap find the every bitmap
func FindEveryBitmap(args ...interface{}) (int, int) { func FindEveryBitmap(args ...interface{}) (int, int) {
var ( var (