From dd31f29ad5fd0fc7f5ee8d9081a6a8db236b3c82 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Wed, 30 May 2018 23:39:53 +0800 Subject: [PATCH] update savebitmap code --- robotgo.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/robotgo.go b/robotgo.go index ee0ff17..3166227 100644 --- a/robotgo.go +++ b/robotgo.go @@ -1017,14 +1017,14 @@ func BitmapStr(str string) C.MMBitmapRef { // SaveBitmap save the bitmap to image // robotgo.SaveBimap(bitmap C.MMBitmapRef, path string, type int) -func SaveBitmap(args ...interface{}) string { +func SaveBitmap(bitmap C.MMBitmapRef, gpath string, args ...interface{}) string { var mtype C.uint16_t = 1 - if len(args) > 2 { - mtype = C.uint16_t(args[2].(int)) + if len(args) > 0 { + mtype = C.uint16_t(args[0].(int)) } - path := C.CString(args[1].(string)) - saveBit := C.bitmap_save(args[0].(C.MMBitmapRef), path, mtype) + path := C.CString(gpath) + saveBit := C.bitmap_save(bitmap, path, mtype) // fmt.Println("saved...", saveBit) // return bit defer C.free(unsafe.Pointer(path))