mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +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){
|
||||
if (saveMMBitmapToFile(bitmap, path, type) != 0) {
|
||||
char *aSaveBitmap(MMBitmapRef bitmap,char *path, uint16_t type){
|
||||
if (saveMMBitmapToFile(bitmap, path,(MMImageType) type) != 0) {
|
||||
return "Could not save image to file.";
|
||||
}else{
|
||||
saveMMBitmapToFile(bitmap, path, type);
|
||||
saveMMBitmapToFile(bitmap, path, (MMImageType) type);
|
||||
}
|
||||
//destroyMMBitmap(bitmap);
|
||||
return "ok";
|
||||
|
36
robotgo.go
36
robotgo.go
@ -231,30 +231,30 @@ 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.uint16_t
|
||||
Try(func() {
|
||||
mtype = C.uint16_t(args[2].(int))
|
||||
}, func(e interface{}) {
|
||||
Println("err:::", e)
|
||||
mtype = 1
|
||||
})
|
||||
|
||||
// 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)
|
||||
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))
|
||||
// }
|
||||
|
||||
func TostringBitmap(bit C.MMBitmapRef) *C.char {
|
||||
str_bit := C.aTostringBitmap(bit)
|
||||
// Println("...", str_bit)
|
||||
|
Loading…
Reference in New Issue
Block a user