From 7ae127373ed9822616ed585f3fe9b90c99d9635f Mon Sep 17 00:00:00 2001 From: vcaesar Date: Tue, 13 Feb 2018 19:07:35 +0800 Subject: [PATCH] update getportion param to go type --- robotgo.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/robotgo.go b/robotgo.go index 3223415..4bd9d9e 100644 --- a/robotgo.go +++ b/robotgo.go @@ -967,12 +967,12 @@ func ToMMBitmapRef(bit CBitmap) C.MMBitmapRef { } // 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 - rect.origin.x = x - rect.origin.y = y - rect.size.width = w - rect.size.height = h + rect.origin.x = C.size_t(x) + rect.origin.y = C.size_t(y) + rect.size.width = C.size_t(w) + rect.size.height = C.size_t(h) pos := C.get_portion(bit, rect) return pos @@ -1097,10 +1097,10 @@ func GetImgSize(imgPath string) (int, int) { bitmap := OpenBitmap(imgPath) gbit := ToBitmap(bitmap) - x := gbit.Width / 2 - y := gbit.Height / 2 + w := gbit.Width / 2 + h := gbit.Height / 2 - return x, y + return w, h } /*