From 44578aad4832023bb74b02019b3f8b7b81fe722c Mon Sep 17 00:00:00 2001 From: vCaesar Date: Thu, 29 Jun 2017 23:06:25 +0800 Subject: [PATCH] Update freebitmap and rename some c func --- bitmap/goBitmap.h | 4 ++-- robotgo.go | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bitmap/goBitmap.h b/bitmap/goBitmap.h index f50bab2..dc6911a 100644 --- a/bitmap/goBitmap.h +++ b/bitmap/goBitmap.h @@ -77,7 +77,7 @@ MMPoint aFindBitmap(MMBitmapRef bit_map, MMRect rect){ return point; } -MMBitmapRef aOpenBitmap(char *path, uint16_t ttype){ +MMBitmapRef bitmap_open(char *path, uint16_t ttype){ // MMImageType type; MMBitmapRef bitmap; @@ -89,7 +89,7 @@ MMBitmapRef aOpenBitmap(char *path, uint16_t ttype){ } -char *aSaveBitmap(MMBitmapRef bitmap, char *path, uint16_t type){ +char *bitmap_save(MMBitmapRef bitmap, char *path, uint16_t type){ if (saveMMBitmapToFile(bitmap, path, (MMImageType) type) != 0) { return "Could not save image to file."; }else{ diff --git a/robotgo.go b/robotgo.go index 59859df..860abca 100644 --- a/robotgo.go +++ b/robotgo.go @@ -589,7 +589,7 @@ func OpenBitmap(args ...interface{}) C.MMBitmapRef { // fmt.Println("err:::", e) mtype = 1 }) - bit := C.aOpenBitmap(path, mtype) + bit := C.bitmap_open(path, mtype) defer C.free(unsafe.Pointer(path)) // fmt.Println("opening...", bit) return bit @@ -607,7 +607,7 @@ func SaveBitmap(args ...interface{}) string { }) path := C.CString(args[1].(string)) - savebit := C.aSaveBitmap(args[0].(C.MMBitmapRef), path, mtype) + savebit := C.bitmap_save(args[0].(C.MMBitmapRef), path, mtype) // fmt.Println("saved...", savebit) // return bit defer C.free(unsafe.Pointer(path)) @@ -662,8 +662,9 @@ func Convert(args ...interface{}) { } // FreeBitmap free and dealloc bitmap -func FreeBitmap(ref C.MMBitmapRef) { - C.destroyMMBitmap(ref) +func FreeBitmap(bitmap C.MMBitmapRef) { + // C.destroyMMBitmap(bitmap) + C.bitmap_dealloc(bitmap) } // ReadBitmap returns false and sets error if |bitmap| is NULL