mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +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
|
||||
#cgo linux CFLAGS: -I/usr/src
|
||||
#cgo linux LDFLAGS: -L/usr/src -lpng -lz -lX11 -lXtst -lm
|
||||
// #cgo linux LDFLAGS: -lX11-xcb -lxcb -lxcb-xkb -lxkbcommon -lxkbcommon-x11
|
||||
//#endif
|
||||
// #cgo windows LDFLAGS: -lgdi32 -luser32 -lpng -lz
|
||||
#cgo windows LDFLAGS: -lgdi32 -luser32
|
||||
@ -297,19 +298,7 @@ func GoCaptureScreen(args ...int) Bitmap {
|
||||
|
||||
// SaveCapture capture screen and save
|
||||
func SaveCapture(spath string, args ...int) {
|
||||
var bit C.MMBitmapRef
|
||||
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()
|
||||
}
|
||||
bit := CaptureScreen(args...)
|
||||
|
||||
SaveBitmap(bit, spath)
|
||||
FreeBitmap(bit)
|
||||
|
Loading…
Reference in New Issue
Block a user