uBMP is a library for microcontrollers ( and all small size RAM devices ) to read bitmap files
Library uses FatFS for fopen, fread, fseek and fclose functions.
Library consist of these functions:
- uBMP *bmp_open(char *file);
Open a file and read header and allocate a uBMP structure and return the pointer to allocated uBMP structure.
-
uint16_t bmp_getwidth(uBMP *bmp);
-
uint16_t bmp_getheight(uBMP *bmp);
Read the width/height of opened bitmap file, take uBMP structure as input to read.
- RGB_t bmp_getpixel(uBMP *bmp, uint16_t x, uint16_t y);
Read a pixel from given (x,y) coordinate, return a RGB_t structure.
-
RGB_t* bmp_getcol(uBMP *bmp, uint16_t x);
-
RGB_t* bmp_getrow(uBMP *bmp, uint16_t y);
Read a column/row from given x or y, allocate RGB_t array and return it. User SHOULD free RGB_t array after use.
- void bmp_close(uBMP *bmp);
Close opened bitmap file, and free allocated structure.
- void bmp_loadsize(char *file, SIZE_t *size);
Load bitmap size with just filename and one function call. and fill SIZE_t address.
And thats it, a simple bitmap library!