From 979a569edaddfbb034b37380bb86c44f5d41d841 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Thu, 14 Sep 2017 21:44:06 +0800 Subject: [PATCH] Update bitmap --- bitmap/goBitmap.h | 17 +++++++++++++++-- robotgo.go | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/bitmap/goBitmap.h b/bitmap/goBitmap.h index 4e682b0..dfba1de 100644 --- a/bitmap/goBitmap.h +++ b/bitmap/goBitmap.h @@ -116,7 +116,7 @@ char *bitmap_save(MMBitmapRef bitmap, char *path, uint16_t type){ return "ok"; } -char *aTostringBitmap(MMBitmapRef bitmap){ +char *tostring_Bitmap(MMBitmapRef bitmap){ char *buf = NULL; MMBMPStringError err; @@ -125,7 +125,20 @@ char *aTostringBitmap(MMBitmapRef bitmap){ return buf; } -MMBitmapRef aGetPortion(MMBitmapRef bit_map, MMRect rect){ +// out with size 200 is enough +bool bitmap_str(MMBitmapRef bitmap, char *out){ + if (!bitmap_ready(bitmap)) return false; + sprintf(out, "", + (unsigned long)bitmap->width, + (unsigned long)bitmap->height, + bitmap->bitsPerPixel, + bitmap->bytesPerPixel); + + return true; +} + +MMBitmapRef get_Portion(MMBitmapRef bit_map, MMRect rect){ // MMRect rect; MMBitmapRef portion = NULL; diff --git a/robotgo.go b/robotgo.go index 449bd7a..4bf0cde 100644 --- a/robotgo.go +++ b/robotgo.go @@ -668,7 +668,7 @@ func SaveBitmap(args ...interface{}) string { // TostringBitmap tostring bitmap func TostringBitmap(bit C.MMBitmapRef) *C.char { // str_bit := C.aTostringBitmap(bit) - strBit := C.aTostringBitmap(bit) + strBit := C.tostring_Bitmap(bit) // fmt.Println("...", str_bit) // return str_bit return strBit @@ -682,7 +682,7 @@ func GetPortion(bit C.MMBitmapRef, x, y, w, h C.size_t) C.MMBitmapRef { rect.size.width = w rect.size.height = h - pos := C.aGetPortion(bit, rect) + pos := C.get_Portion(bit, rect) return pos }