mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
update getportion param to go type
This commit is contained in:
parent
0eda71b5e5
commit
7ae127373e
16
robotgo.go
16
robotgo.go
@ -967,12 +967,12 @@ func ToMMBitmapRef(bit CBitmap) C.MMBitmapRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetPortion get bitmap portion
|
// GetPortion get bitmap portion
|
||||||
func GetPortion(bit C.MMBitmapRef, x, y, w, h C.size_t) C.MMBitmapRef {
|
func GetPortion(bit C.MMBitmapRef, x, y, w, h int) C.MMBitmapRef {
|
||||||
var rect C.MMRect
|
var rect C.MMRect
|
||||||
rect.origin.x = x
|
rect.origin.x = C.size_t(x)
|
||||||
rect.origin.y = y
|
rect.origin.y = C.size_t(y)
|
||||||
rect.size.width = w
|
rect.size.width = C.size_t(w)
|
||||||
rect.size.height = h
|
rect.size.height = C.size_t(h)
|
||||||
|
|
||||||
pos := C.get_portion(bit, rect)
|
pos := C.get_portion(bit, rect)
|
||||||
return pos
|
return pos
|
||||||
@ -1097,10 +1097,10 @@ func GetImgSize(imgPath string) (int, int) {
|
|||||||
bitmap := OpenBitmap(imgPath)
|
bitmap := OpenBitmap(imgPath)
|
||||||
gbit := ToBitmap(bitmap)
|
gbit := ToBitmap(bitmap)
|
||||||
|
|
||||||
x := gbit.Width / 2
|
w := gbit.Width / 2
|
||||||
y := gbit.Height / 2
|
h := gbit.Height / 2
|
||||||
|
|
||||||
return x, y
|
return w, h
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user