mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-08 09:33:56 +00:00
add find image by path
This commit is contained in:
parent
26e0b82abc
commit
b99914bc5e
26
robotgo.go
26
robotgo.go
@ -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 (
|
||||||
|
Loading…
Reference in New Issue
Block a user