mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-24 10:19:01 +00:00
add find image by path
This commit is contained in:
parent
26e0b82abc
commit
b99914bc5e
1 changed files with 26 additions and 0 deletions
26
robotgo.go
26
robotgo.go
|
|
@ -809,6 +809,32 @@ func FindBitmap(args ...interface{}) (int, int) {
|
|||
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
|
||||
func FindEveryBitmap(args ...interface{}) (int, int) {
|
||||
var (
|
||||
|
|
|
|||
Loading…
Reference in a new issue