mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-03 23:53:54 +00:00
update ci and add func internalFindBitmap
This commit is contained in:
parent
f6cd1d99dd
commit
d54cbecb37
@ -3,7 +3,7 @@ version: "{build}"
|
|||||||
|
|
||||||
# Operating system (build VM template)
|
# Operating system (build VM template)
|
||||||
# os: Windows Server 2012 R2
|
# os: Windows Server 2012 R2
|
||||||
os: Visual Studio 2015
|
os: Visual Studio 2017
|
||||||
|
|
||||||
# Platform.
|
# Platform.
|
||||||
# platform:
|
# platform:
|
||||||
|
16
robotgo.go
16
robotgo.go
@ -783,6 +783,12 @@ func SetKeyboardDelay(x int) {
|
|||||||
|______/ |__| |__| |__| |__| /__/ \__\ | _|
|
|______/ |__| |__| |__| |__| /__/ \__\ | _|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
func internalFindBitmap(bit, sbit C.MMBitmapRef, tolerance float64) (int, int) {
|
||||||
|
pos := C.find_bitmap(bit, sbit, C.float(tolerance))
|
||||||
|
// fmt.Println("pos----", pos)
|
||||||
|
return int(pos.x), int(pos.y)
|
||||||
|
}
|
||||||
|
|
||||||
// FindBitmap find the bitmap
|
// FindBitmap find the bitmap
|
||||||
//
|
//
|
||||||
// robotgo.FindBitmap(bitmap, subbitamp C.MMBitmapRef, tolerance float64)
|
// robotgo.FindBitmap(bitmap, subbitamp C.MMBitmapRef, tolerance float64)
|
||||||
@ -791,7 +797,7 @@ func FindBitmap(args ...interface{}) (int, int) {
|
|||||||
var (
|
var (
|
||||||
bit C.MMBitmapRef
|
bit C.MMBitmapRef
|
||||||
sbit C.MMBitmapRef
|
sbit C.MMBitmapRef
|
||||||
tolerance C.float
|
tolerance float64
|
||||||
)
|
)
|
||||||
|
|
||||||
bit = args[0].(C.MMBitmapRef)
|
bit = args[0].(C.MMBitmapRef)
|
||||||
@ -802,14 +808,12 @@ func FindBitmap(args ...interface{}) (int, int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(args) > 2 {
|
if len(args) > 2 {
|
||||||
tolerance = C.float(args[2].(float64))
|
tolerance = args[2].(float64)
|
||||||
} else {
|
} else {
|
||||||
tolerance = 0.5
|
tolerance = 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
pos := C.find_bitmap(bit, sbit, tolerance)
|
return internalFindBitmap(bit, sbit, tolerance)
|
||||||
// fmt.Println("pos----", pos)
|
|
||||||
return int(pos.x), int(pos.y)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindPic finding the image by path
|
// FindPic finding the image by path
|
||||||
@ -836,7 +840,7 @@ func FindPic(path string, args ...interface{}) (int, int) {
|
|||||||
tolerance = 0.5
|
tolerance = 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
fx, fy := FindBitmap(openbit, sbit, tolerance)
|
fx, fy := internalFindBitmap(openbit, sbit, tolerance)
|
||||||
|
|
||||||
return fx, fy
|
return fx, fy
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user