diff --git a/README.md b/README.md index 84d623e..013e785 100644 --- a/README.md +++ b/README.md @@ -270,7 +270,7 @@ func main() { } ``` -#### [Bitmap](https://github.com/go-vgo/robotgo/blob/master/examples/bitmap/main.go) +#### [Bitmap](https://github.com/vcaesar/bitmap/blob/master/examples/main.go) ```Go package main @@ -370,7 +370,7 @@ func opencv() { } ``` -#### [Event](https://github.com/go-vgo/robotgo/blob/master/examples/gohook/main.go) +#### [Event](https://github.com/robotn/gohook/blob/master/examples/main.go) ```Go package main diff --git a/base/MMBitmap.h b/base/MMBitmap.h index 68fccd4..b652a2d 100644 --- a/base/MMBitmap.h +++ b/base/MMBitmap.h @@ -11,7 +11,7 @@ struct _MMBitmap { uint8_t *imageBuffer; /* Pixels stored in Quad I format; */ int32_t width; /* Never 0, unless image is NULL. */ int32_t height; /* Never 0, unless image is NULL. */ - size_t bytewidth; /* The aligned width (width + padding). */ + int32_t bytewidth; /* The aligned width (width + padding). */ uint8_t bitsPerPixel; /* Should be either 24 or 32. */ uint8_t bytesPerPixel; /* For convenience; should be bitsPerPixel / 8. */ }; diff --git a/base/bitmap_free_c.h b/base/bitmap_free_c.h index 803037f..90e20a3 100644 --- a/base/bitmap_free_c.h +++ b/base/bitmap_free_c.h @@ -3,7 +3,7 @@ #include MMBitmapRef createMMBitmap_c(uint8_t *buffer, int32_t width, int32_t height, - size_t bytewidth, uint8_t bitsPerPixel, uint8_t bytesPerPixel + int32_t bytewidth, uint8_t bitsPerPixel, uint8_t bytesPerPixel ) { MMBitmapRef bitmap = malloc(sizeof(MMBitmap)); if (bitmap == NULL) { return NULL; } diff --git a/robotgo.go b/robotgo.go index 8d1f451..f73c593 100644 --- a/robotgo.go +++ b/robotgo.go @@ -375,7 +375,7 @@ func ToCBitmap(bit Bitmap) CBitmap { (*C.uint8_t)(bit.ImgBuf), C.int32_t(bit.Width), C.int32_t(bit.Height), - C.size_t(bit.Bytewidth), + C.int32_t(bit.Bytewidth), C.uint8_t(bit.BitsPixel), C.uint8_t(bit.BytesPerPixel), ) diff --git a/screen/screengrab_c.h b/screen/screengrab_c.h index 883decb..adb78b4 100644 --- a/screen/screengrab_c.h +++ b/screen/screengrab_c.h @@ -35,8 +35,9 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id) buffer = malloc(bufferSize); CFDataGetBytes(imageData, CFRangeMake(0, bufferSize), buffer); - bitmap = createMMBitmap_c(buffer, CGImageGetWidth(image), CGImageGetHeight(image), - CGImageGetBytesPerRow(image), CGImageGetBitsPerPixel(image),CGImageGetBitsPerPixel(image) / 8); + bitmap = createMMBitmap_c(buffer, + CGImageGetWidth(image), CGImageGetHeight(image), CGImageGetBytesPerRow(image), + CGImageGetBitsPerPixel(image), CGImageGetBitsPerPixel(image) / 8); CFRelease(imageData); CGImageRelease(image);