mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-17 13:33:55 +00:00
Merge 932a918e44
into 217d6cf1f1
This commit is contained in:
commit
4273e546ba
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module github.com/go-vgo/robotgo
|
module github.com/aohanhongzhi/robotgo
|
||||||
|
|
||||||
go 1.22
|
go 1.22
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ package robotgo
|
|||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"image"
|
"image"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
@ -366,11 +367,14 @@ func CaptureGo(args ...int) Bitmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CaptureImg capture the screen and return image.Image
|
// CaptureImg capture the screen and return image.Image
|
||||||
func CaptureImg(args ...int) image.Image {
|
func CaptureImg(args ...int) (image.Image, error) {
|
||||||
bit := CaptureScreen(args...)
|
bit := CaptureScreen(args...)
|
||||||
|
if bit == nil {
|
||||||
|
return nil, errors.New("capture error")
|
||||||
|
}
|
||||||
defer FreeBitmap(bit)
|
defer FreeBitmap(bit)
|
||||||
|
|
||||||
return ToImage(bit)
|
return ToImage(bit), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FreeBitmap free and dealloc the C bitmap
|
// FreeBitmap free and dealloc the C bitmap
|
||||||
|
Loading…
Reference in New Issue
Block a user