mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +00:00
update find bitmap and color
This commit is contained in:
parent
488a81253f
commit
25a4002924
@ -75,7 +75,7 @@ MMPointArrayRef find_every_bitmap(MMBitmapRef bitmap, MMBitmapRef sbit, float to
|
||||
MMRect rect = MMBitmapGetBounds(sbit);
|
||||
|
||||
if (findBitmapInRect(bitmap, sbit, &point, rect, tolerance) == 0) {
|
||||
return NULL;
|
||||
// return NULL;
|
||||
}
|
||||
|
||||
pointArray = findAllBitmapInRect(bitmap, sbit, rect, tolerance);
|
||||
|
11
robotgo.go
11
robotgo.go
@ -1055,10 +1055,13 @@ func FindEveryBitmap(bit C.MMBitmapRef, args ...interface{}) (posArr []MPoint) {
|
||||
|
||||
pos := C.find_every_bitmap(bit, sbit, tolerance, &lpos)
|
||||
// FreeBitmap(bit)
|
||||
defer FreeMMPointArr(pos)
|
||||
if len(args) <= 0 {
|
||||
FreeBitmap(sbit)
|
||||
}
|
||||
if pos == nil {
|
||||
return
|
||||
}
|
||||
defer FreeMMPointArr(pos)
|
||||
|
||||
cSize := pos.count
|
||||
cArray := pos.array
|
||||
@ -1346,11 +1349,15 @@ func FindEveryColor(color CHex, args ...interface{}) (posArr []MPoint) {
|
||||
}
|
||||
|
||||
pos := C.bitmap_find_every_color(bitmap, C.MMRGBHex(color), tolerance, &lpos)
|
||||
defer FreeMMPointArr(pos)
|
||||
if len(args) <= 0 {
|
||||
FreeBitmap(bitmap)
|
||||
}
|
||||
|
||||
if pos == nil {
|
||||
return
|
||||
}
|
||||
defer FreeMMPointArr(pos)
|
||||
|
||||
cSize := pos.count
|
||||
cArray := pos.array
|
||||
gSlice := (*[1 << 30]C.MMPoint)(unsafe.Pointer(cArray))[:cSize:cSize]
|
||||
|
Loading…
Reference in New Issue
Block a user