diff --git a/bitmap/goBitmap.h b/bitmap/goBitmap.h index 0ac6557..68f16b6 100644 --- a/bitmap/goBitmap.h +++ b/bitmap/goBitmap.h @@ -83,7 +83,7 @@ MMPointArrayRef find_every_bitmap(MMBitmapRef bitmap, MMBitmapRef sbit, float to } int count_of_bitmap(MMBitmapRef bitmap, MMBitmapRef sbit, float tolerance){ - if (!bitmap_ready(bitmap) || !bitmap_ready(sbit)) return 0; + if (!bitmap_ready(bitmap) || !bitmap_ready(sbit)) { return 0; } MMRect rect = MMBitmapGetBounds(bitmap); return countOfBitmapInRect(bitmap, sbit, rect, tolerance); @@ -109,7 +109,6 @@ MMBitmapRef bitmap_open(char *path, uint16_t ttype){ bitmap = newMMBitmapFromFile(path, ttype, &err); // printf("....%zd\n", bitmap->width); return bitmap; - } MMBitmapRef bitmap_from_string(const char *str){ @@ -118,7 +117,7 @@ MMBitmapRef bitmap_from_string(const char *str){ MMBitmapRef bitmap; MMBMPStringError err; - if ((bitmap = createMMBitmapFromString((unsigned char*)str, len, &err )) + if ((bitmap = createMMBitmapFromString((unsigned char*)str, len, &err)) == NULL) { return NULL; } @@ -144,7 +143,7 @@ char *tostring_bitmap(MMBitmapRef bitmap){ // out with size 200 is enough bool bitmap_str(MMBitmapRef bitmap, char *out){ - if (!bitmap_ready(bitmap)) return false; + if (!bitmap_ready(bitmap)) { return false; } sprintf(out, "", (unsigned long)bitmap->width, diff --git a/examples/bitmap/main.go b/examples/bitmap/main.go index a9318d2..dea7b84 100644 --- a/examples/bitmap/main.go +++ b/examples/bitmap/main.go @@ -57,6 +57,9 @@ func findColor(bmp robotgo.CBitmap) { fmt.Println("count...", cnt) cnt1 := robotgo.CountColorCS(0xAADCDC, 10, 20, 30, 40) fmt.Println("count...", cnt1) + + arr := robotgo.FindEveryColor(0xAADCDC) + fmt.Println("find all color: ", arr) } func bitmapString(bmp robotgo.CBitmap) { @@ -146,6 +149,9 @@ func findBitmap(bmp robotgo.CBitmap) { fx, fy = robotgo.FindPic("test.tif") fmt.Println("FindPic------", fx, fy) + + arr := robotgo.FindEveryBitmap(openbit) + fmt.Println("find all bitmap: ", arr) } func bitmap() {