Update bitmap

This commit is contained in:
vCaesar 2016-10-20 18:04:41 +08:00
parent 170b5eb116
commit 8d19ec60b8
2 changed files with 21 additions and 21 deletions

View File

@ -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";

View File

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