mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
Update bitmap test
This commit is contained in:
parent
be247066d1
commit
f147f7866a
28
robotgo.go
28
robotgo.go
@ -225,17 +225,25 @@ func OpenBitmap(gpath string) C.MMBitmapRef {
|
|||||||
// defer C.free(unsafe.Pointer(path))
|
// defer C.free(unsafe.Pointer(path))
|
||||||
}
|
}
|
||||||
|
|
||||||
func SaveBitmap(args ...interface{}) {
|
// func SaveBitmap(args ...interface{}) {
|
||||||
var mtype C.MMImageType
|
// var mtype C.MMImageType
|
||||||
Try(func() {
|
// Try(func() {
|
||||||
mtype = args[2].(C.MMImageType)
|
// mtype = args[2].(C.MMImageType)
|
||||||
}, func(e interface{}) {
|
// }, func(e interface{}) {
|
||||||
Println("err:::", e)
|
// Println("err:::", e)
|
||||||
mtype = 1
|
// mtype = 1
|
||||||
})
|
// })
|
||||||
|
|
||||||
path := C.CString(args[1].(string))
|
// path := C.CString(args[1].(string))
|
||||||
savebit := C.aSaveBitmap(args[0].(C.MMBitmapRef), path, mtype)
|
// savebit := C.aSaveBitmap(args[0].(C.MMBitmapRef), path, mtype)
|
||||||
|
// Println("opening...", savebit)
|
||||||
|
// // return bit
|
||||||
|
// // defer C.free(unsafe.Pointer(path))
|
||||||
|
// }
|
||||||
|
|
||||||
|
func SaveBitmap(bit C.MMBitmapRef, gpath string, mtype C.MMImageType) {
|
||||||
|
path := C.CString(gpath)
|
||||||
|
savebit := C.aSaveBitmap(bit, path, mtype)
|
||||||
Println("opening...", savebit)
|
Println("opening...", savebit)
|
||||||
// return bit
|
// return bit
|
||||||
// defer C.free(unsafe.Pointer(path))
|
// defer C.free(unsafe.Pointer(path))
|
||||||
|
@ -28,6 +28,8 @@ func arobotgo() {
|
|||||||
bit_map := robotgo.CaptureScreen(10, 20, 30, 40)
|
bit_map := robotgo.CaptureScreen(10, 20, 30, 40)
|
||||||
Println("...", bit_map)
|
Println("...", bit_map)
|
||||||
|
|
||||||
|
robotgo.SaveBitmap(bit_map, "test.png", 1)
|
||||||
|
|
||||||
// robotgo.MouseClick()
|
// robotgo.MouseClick()
|
||||||
robotgo.ScrollMouse(10, "up")
|
robotgo.ScrollMouse(10, "up")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user