Update bitmap test

This commit is contained in:
vCaesar 2016-10-20 17:32:45 +08:00
parent be247066d1
commit f147f7866a
2 changed files with 20 additions and 10 deletions

View File

@ -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))

View File

@ -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")
}