mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-31 06:13: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))
|
||||
}
|
||||
|
||||
func SaveBitmap(args ...interface{}) {
|
||||
var mtype C.MMImageType
|
||||
Try(func() {
|
||||
mtype = args[2].(C.MMImageType)
|
||||
}, func(e interface{}) {
|
||||
Println("err:::", e)
|
||||
mtype = 1
|
||||
})
|
||||
// func SaveBitmap(args ...interface{}) {
|
||||
// var mtype C.MMImageType
|
||||
// Try(func() {
|
||||
// mtype = args[2].(C.MMImageType)
|
||||
// }, func(e interface{}) {
|
||||
// Println("err:::", e)
|
||||
// mtype = 1
|
||||
// })
|
||||
|
||||
path := C.CString(args[1].(string))
|
||||
savebit := C.aSaveBitmap(args[0].(C.MMBitmapRef), path, mtype)
|
||||
// path := C.CString(args[1].(string))
|
||||
// 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)
|
||||
// return bit
|
||||
// defer C.free(unsafe.Pointer(path))
|
||||
|
@ -28,6 +28,8 @@ func arobotgo() {
|
||||
bit_map := robotgo.CaptureScreen(10, 20, 30, 40)
|
||||
Println("...", bit_map)
|
||||
|
||||
robotgo.SaveBitmap(bit_map, "test.png", 1)
|
||||
|
||||
// robotgo.MouseClick()
|
||||
robotgo.ScrollMouse(10, "up")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user