mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
Simplify SaveCapture code
This commit is contained in:
parent
36e220b7a1
commit
68ba8e8aaa
15
robotgo.go
15
robotgo.go
@ -32,6 +32,7 @@ package robotgo
|
|||||||
// Drop -std=c11
|
// Drop -std=c11
|
||||||
#cgo linux CFLAGS: -I/usr/src
|
#cgo linux CFLAGS: -I/usr/src
|
||||||
#cgo linux LDFLAGS: -L/usr/src -lpng -lz -lX11 -lXtst -lm
|
#cgo linux LDFLAGS: -L/usr/src -lpng -lz -lX11 -lXtst -lm
|
||||||
|
// #cgo linux LDFLAGS: -lX11-xcb -lxcb -lxcb-xkb -lxkbcommon -lxkbcommon-x11
|
||||||
//#endif
|
//#endif
|
||||||
// #cgo windows LDFLAGS: -lgdi32 -luser32 -lpng -lz
|
// #cgo windows LDFLAGS: -lgdi32 -luser32 -lpng -lz
|
||||||
#cgo windows LDFLAGS: -lgdi32 -luser32
|
#cgo windows LDFLAGS: -lgdi32 -luser32
|
||||||
@ -297,19 +298,7 @@ func GoCaptureScreen(args ...int) Bitmap {
|
|||||||
|
|
||||||
// SaveCapture capture screen and save
|
// SaveCapture capture screen and save
|
||||||
func SaveCapture(spath string, args ...int) {
|
func SaveCapture(spath string, args ...int) {
|
||||||
var bit C.MMBitmapRef
|
bit := CaptureScreen(args...)
|
||||||
if len(args) > 3 {
|
|
||||||
var (
|
|
||||||
x = args[0]
|
|
||||||
y = args[1]
|
|
||||||
w = args[2]
|
|
||||||
h = args[3]
|
|
||||||
)
|
|
||||||
|
|
||||||
bit = CaptureScreen(x, y, w, h)
|
|
||||||
} else {
|
|
||||||
bit = CaptureScreen()
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveBitmap(bit, spath)
|
SaveBitmap(bit, spath)
|
||||||
FreeBitmap(bit)
|
FreeBitmap(bit)
|
||||||
|
Loading…
Reference in New Issue
Block a user