image_p image_load_jpg(const char* filename, int displaymode) { image_p pimage = NULL; int size; char *mbuf; int handle = io_fopen(filename,IO_RDONLY); if(handle == 0) return 0; size = io_fsize(handle); mbuf = (char*) malloc(size); io_fread(mbuf,1,size,handle); io_fclose(handle); pimage = image_load_jpg_buf(mbuf,size,displaymode); SAFE_FREE(mbuf); return pimage; }
////////////////////////////////////////////////////////////////////////// //load bmp //support 24/32 bmp (NOT support 16) ////////////////////////////////////////////////////////////////////////// image_p image_load_bmp(const char* filename, int displaymode) { image_p pimage = NULL; int size ; uint8_t* pbuf; int fd = io_fopen(filename,IO_RDONLY); if(fd == 0) return 0; size = io_fsize(fd); pbuf = (uint8_t*)malloc(size); io_fread(pbuf,1,size,fd); io_fclose(fd); pimage = image_load_bmp_buf((const char*)pbuf,size,displaymode); SAFE_FREE(pbuf); return pimage; }