From c562426b5ebf3431766e46e618c7a6c7218db2e6 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Tue, 7 Sep 2021 12:44:31 -0400 Subject: [PATCH] add ToRGBA() function support --- robotgo.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/robotgo.go b/robotgo.go index c88163c..0a80d3e 100644 --- a/robotgo.go +++ b/robotgo.go @@ -983,6 +983,11 @@ func ByteToImg(b []byte) (image.Image, error) { // ToImage convert C.MMBitmapRef to standard image.Image func ToImage(bit C.MMBitmapRef) image.Image { + return ToRGBA(bit) +} + +// ToRGBA convert C.MMBitmapRef to standard image.RGBA +func ToRGBA(bit C.MMBitmapRef) *image.RGBA { bmp1 := ToBitmap(bit) img1 := image.NewRGBA(image.Rect(0, 0, bmp1.Width, bmp1.Height)) img1.Pix = make([]uint8, bmp1.Bytewidth*bmp1.Height)