Update bitmap

This commit is contained in:
vcaesar 2017-09-14 21:44:06 +08:00
parent d520880502
commit 979a569eda
2 changed files with 17 additions and 4 deletions

View File

@ -116,7 +116,7 @@ char *bitmap_save(MMBitmapRef bitmap, char *path, uint16_t type){
return "ok";
}
char *aTostringBitmap(MMBitmapRef bitmap){
char *tostring_Bitmap(MMBitmapRef bitmap){
char *buf = NULL;
MMBMPStringError err;
@ -125,7 +125,20 @@ char *aTostringBitmap(MMBitmapRef bitmap){
return buf;
}
MMBitmapRef aGetPortion(MMBitmapRef bit_map, MMRect rect){
// out with size 200 is enough
bool bitmap_str(MMBitmapRef bitmap, char *out){
if (!bitmap_ready(bitmap)) return false;
sprintf(out, "<Bitmap with resolution %lu%lu, \
%u bits per pixel, and %u bytes per pixel>",
(unsigned long)bitmap->width,
(unsigned long)bitmap->height,
bitmap->bitsPerPixel,
bitmap->bytesPerPixel);
return true;
}
MMBitmapRef get_Portion(MMBitmapRef bit_map, MMRect rect){
// MMRect rect;
MMBitmapRef portion = NULL;

View File

@ -668,7 +668,7 @@ func SaveBitmap(args ...interface{}) string {
// TostringBitmap tostring bitmap
func TostringBitmap(bit C.MMBitmapRef) *C.char {
// str_bit := C.aTostringBitmap(bit)
strBit := C.aTostringBitmap(bit)
strBit := C.tostring_Bitmap(bit)
// fmt.Println("...", str_bit)
// return str_bit
return strBit
@ -682,7 +682,7 @@ func GetPortion(bit C.MMBitmapRef, x, y, w, h C.size_t) C.MMBitmapRef {
rect.size.width = w
rect.size.height = h
pos := C.aGetPortion(bit, rect)
pos := C.get_Portion(bit, rect)
return pos
}