mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
Update bitmap
This commit is contained in:
parent
170b5eb116
commit
8d19ec60b8
@ -30,11 +30,11 @@ MMBitmapRef aOpenBitmap(char *path){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *aSaveBitmap(MMBitmapRef bitmap,char *path, MMImageType type){
|
char *aSaveBitmap(MMBitmapRef bitmap,char *path, uint16_t type){
|
||||||
if (saveMMBitmapToFile(bitmap, path, type) != 0) {
|
if (saveMMBitmapToFile(bitmap, path,(MMImageType) type) != 0) {
|
||||||
return "Could not save image to file.";
|
return "Could not save image to file.";
|
||||||
}else{
|
}else{
|
||||||
saveMMBitmapToFile(bitmap, path, type);
|
saveMMBitmapToFile(bitmap, path, (MMImageType) type);
|
||||||
}
|
}
|
||||||
//destroyMMBitmap(bitmap);
|
//destroyMMBitmap(bitmap);
|
||||||
return "ok";
|
return "ok";
|
||||||
|
36
robotgo.go
36
robotgo.go
@ -231,30 +231,30 @@ 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.uint16_t
|
||||||
// Try(func() {
|
Try(func() {
|
||||||
// mtype = args[2].(C.MMImageType)
|
mtype = C.uint16_t(args[2].(int))
|
||||||
// }, 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))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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))
|
||||||
|
// }
|
||||||
|
|
||||||
func TostringBitmap(bit C.MMBitmapRef) *C.char {
|
func TostringBitmap(bit C.MMBitmapRef) *C.char {
|
||||||
str_bit := C.aTostringBitmap(bit)
|
str_bit := C.aTostringBitmap(bit)
|
||||||
// Println("...", str_bit)
|
// Println("...", str_bit)
|
||||||
|
Loading…
Reference in New Issue
Block a user