Library to print a bmp from a file to the LCD display. This library depends on the FatFs from ChaN.
More...
|
file | bmp.c |
| Simple graphic library bitmap support.
Library to print a bmp from a file to the LCD display. This library depends on the FatFs from ChaN.
|
|
|
BMP_STATUS | LCD_BMP_ReadHeader (BMP *bmp, FIL *f) |
| Reads the BMP file's header into the data structure. More...
|
|
static int | LCD_BMP_Read_uint32_t (uint32_t *x, FIL *f) |
| Reads a little-endian unsigned int from the file. More...
|
|
static int | LCD_BMP_Read_uint16_t (uint16_t *x, FIL *f) |
| Reads a little-endian unsigned short int from the file. More...
|
|
BMP_STATUS | LCD_BMP_DrawBitmap (const char *filename, uint16_t Xpos, uint16_t Ypos) |
| Reads the specified BMP image file and print it to the LCD.
It does only read bitmaps with 16, 24 or 32 bits per pixel and uncompressed.
To use this, the fatfs must be mounted. More...
|
|
BMP_STATUS | LCD_BMP_ReadFile (BMP *bmp, const char *filename) |
| Reads the specified BMP image file.
It does only read bitmaps with 16, 24 or 32 bits per pixel and uncompressed. To use this, the fatfs must be mounted. More...
|
|
uint32_t | LCD_BMP_GetWidth (BMP *bmp) |
| Returns the image's width. More...
|
|
uint32_t | LCD_BMP_GetHeight (BMP *bmp) |
| Returns the image's height. More...
|
|
uint16_t | LCD_BMP_GetDepth (BMP *bmp) |
| Returns the image's color depth (bits per pixel). More...
|
|
BMP_STATUS | LCD_BMP_GetPixelRGB (BMP *bmp, uint32_t x, uint32_t y, uint8_t *r, uint8_t *g, uint8_t *b) |
| Populates the arguments with the specified pixel's RGB values. More...
|
|
const char * | LCD_BMP_GetErrorDescription (uint8_t errorcode) |
| Returns a description of the last error code. More...
|
|
|
static const char * | BMP_ERROR_STRING [] |
|
Library to print a bmp from a file to the LCD display. This library depends on the FatFs from ChaN.
BMP_STATUS LCD_BMP_DrawBitmap |
( |
const char * |
filename, |
|
|
uint16_t |
Xpos, |
|
|
uint16_t |
Ypos |
|
) |
| |
Reads the specified BMP image file and print it to the LCD.
It does only read bitmaps with 16, 24 or 32 bits per pixel and uncompressed.
To use this, the fatfs must be mounted.
- Parameters
-
[in] | filename | Name of the file (incl. ending and directory) on the sdcard. |
[in] | Xpos | Start X position of the bitmap. |
[in] | Ypos | Start Y position of the bitmap. |
- Returns
- BMP_STATUS
- Examples:
- bitmap.c.
Definition at line 127 of file bmp.c.
uint16_t LCD_BMP_GetDepth |
( |
BMP * |
bmp | ) |
|
Returns the image's color depth (bits per pixel).
- Parameters
-
[in] | bmp | Pointer to the bitmap data buffer. |
- Returns
- Bits per pixel.
Definition at line 285 of file bmp.c.
const char* LCD_BMP_GetErrorDescription |
( |
uint8_t |
errorcode | ) |
|
Returns a description of the last error code.
- Parameters
-
[in] | errorcode | Error Code number. |
- Returns
- Pointer to a const string with the description.
Definition at line 346 of file bmp.c.
uint32_t LCD_BMP_GetHeight |
( |
BMP * |
bmp | ) |
|
Returns the image's height.
- Parameters
-
[in] | bmp | Pointer to the bitmap data buffer. |
- Returns
- The bitmap height.
Definition at line 271 of file bmp.c.
BMP_STATUS LCD_BMP_GetPixelRGB |
( |
BMP * |
bmp, |
|
|
uint32_t |
x, |
|
|
uint32_t |
y, |
|
|
uint8_t * |
r, |
|
|
uint8_t * |
g, |
|
|
uint8_t * |
b |
|
) |
| |
Populates the arguments with the specified pixel's RGB values.
- Parameters
-
[in] | bmp | Pointer to the bitmap data buffer. |
[in] | x | X-Position of the pixel. |
[in] | y | Y-Position of the pixel. |
[out] | r | Red |
[out] | g | Green |
[out] | b | Blue |
- Returns
- BMP_OK if no error.
Definition at line 304 of file bmp.c.
uint32_t LCD_BMP_GetWidth |
( |
BMP * |
bmp | ) |
|
Returns the image's width.
- Parameters
-
[in] | bmp | Pointer to the bitmap data buffer. |
- Returns
- The bitmap width.
Definition at line 257 of file bmp.c.
static int LCD_BMP_Read_uint16_t |
( |
uint16_t * |
x, |
|
|
FIL * |
f |
|
) |
| |
|
static |
Reads a little-endian unsigned short int from the file.
- Parameters
-
[out] | x | Data buffer |
[in] | f | Pointer to the file structure. |
- Returns
- Returns non-zero on success.
Definition at line 436 of file bmp.c.
static int LCD_BMP_Read_uint32_t |
( |
uint32_t * |
x, |
|
|
FIL * |
f |
|
) |
| |
|
static |
Reads a little-endian unsigned int from the file.
- Parameters
-
[out] | x | Data buffer |
[in] | f | Pointer to the file structure. |
- Returns
- Returns non-zero on success.
Definition at line 412 of file bmp.c.
Reads the specified BMP image file.
It does only read bitmaps with 16, 24 or 32 bits per pixel and uncompressed. To use this, the fatfs must be mounted.
- Parameters
-
[out] | bmp | Pointer to the bitmap data buffer. |
[in] | filename | File to read into the buffer. |
Definition at line 200 of file bmp.c.
Reads the BMP file's header into the data structure.
- Parameters
-
[out] | bmp | Pointer to the bitmap data buffer. |
[in] | f | Pointer to the file structure. |
- Returns
- BMP_OK if no error
Definition at line 362 of file bmp.c.
const char* BMP_ERROR_STRING[] |
|
static |
Initial value:= {
"",
"General error",
"Could not allocate enough memory to complete the operation",
"File input/output error",
"File not found",
"File is not a supported BMP variant (must be uncompressed 16, 24 or 32 BPP)",
"File is not a valid BMP image",
"An argument is invalid or out of range",
"The requested action is not compatible with the BMP's type"
}
Definition at line 103 of file bmp.c.