mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
update find every bitmap func
This commit is contained in:
parent
52a7bb04d0
commit
e99cfb6e93
22
robotgo.go
22
robotgo.go
@ -885,38 +885,36 @@ func FindPic(path string, args ...interface{}) (int, int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FindEveryBitmap find the every bitmap
|
// FindEveryBitmap find the every bitmap
|
||||||
func FindEveryBitmap(args ...interface{}) (int, int) {
|
func FindEveryBitmap(bit C.MMBitmapRef, args ...interface{}) (int, int) {
|
||||||
var (
|
var (
|
||||||
bit C.MMBitmapRef
|
|
||||||
sbit C.MMBitmapRef
|
sbit C.MMBitmapRef
|
||||||
tolerance C.float
|
tolerance C.float
|
||||||
lpos C.MMPoint
|
lpos C.MMPoint
|
||||||
)
|
)
|
||||||
|
|
||||||
bit = args[0].(C.MMBitmapRef)
|
if len(args) > 0 {
|
||||||
if len(args) > 1 {
|
sbit = args[0].(C.MMBitmapRef)
|
||||||
sbit = args[1].(C.MMBitmapRef)
|
|
||||||
} else {
|
} else {
|
||||||
sbit = CaptureScreen()
|
sbit = CaptureScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(args) > 2 {
|
if len(args) > 1 {
|
||||||
tolerance = C.float(args[2].(float64))
|
tolerance = C.float(args[1].(float64))
|
||||||
} else {
|
} else {
|
||||||
tolerance = 0.5
|
tolerance = 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(args) > 3 {
|
if len(args) > 2 {
|
||||||
lpos.x = C.size_t(args[3].(int))
|
lpos.x = C.size_t(args[2].(int))
|
||||||
lpos.y = 0
|
lpos.y = 0
|
||||||
} else {
|
} else {
|
||||||
lpos.x = 0
|
lpos.x = 0
|
||||||
lpos.y = 0
|
lpos.y = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(args) > 4 {
|
if len(args) > 3 {
|
||||||
lpos.x = C.size_t(args[3].(int))
|
lpos.x = C.size_t(args[2].(int))
|
||||||
lpos.y = C.size_t(args[4].(int))
|
lpos.y = C.size_t(args[3].(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
pos := C.find_every_bitmap(bit, sbit, tolerance, &lpos)
|
pos := C.find_every_bitmap(bit, sbit, tolerance, &lpos)
|
||||||
|
Loading…
Reference in New Issue
Block a user