sGUI  V1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
BMP

Library to print a bmp from a file to the LCD display. This library depends on the FatFs from ChaN. More...

+ Collaboration diagram for BMP:

Files

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.
 

Functions

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...
 

Variables

static const char * BMP_ERROR_STRING []
 

Detailed Description

Library to print a bmp from a file to the LCD display. This library depends on the FatFs from ChaN.

Function Documentation

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]filenameName of the file (incl. ending and directory) on the sdcard.
[in]XposStart X position of the bitmap.
[in]YposStart Y position of the bitmap.
Returns
BMP_STATUS
Examples:
bitmap.c.

Definition at line 127 of file bmp.c.

+ Here is the call graph for this function:

uint16_t LCD_BMP_GetDepth ( BMP bmp)

Returns the image's color depth (bits per pixel).

Parameters
[in]bmpPointer 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]errorcodeError 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]bmpPointer 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]bmpPointer to the bitmap data buffer.
[in]xX-Position of the pixel.
[in]yY-Position of the pixel.
[out]rRed
[out]gGreen
[out]bBlue
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]bmpPointer 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]xData buffer
[in]fPointer to the file structure.
Returns
Returns non-zero on success.

Definition at line 436 of file bmp.c.

+ Here is the caller graph for this function:

static int LCD_BMP_Read_uint32_t ( uint32_t *  x,
FIL *  f 
)
static

Reads a little-endian unsigned int from the file.

Parameters
[out]xData buffer
[in]fPointer to the file structure.
Returns
Returns non-zero on success.

Definition at line 412 of file bmp.c.

+ Here is the caller graph for this function:

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.

Parameters
[out]bmpPointer to the bitmap data buffer.
[in]filenameFile to read into the buffer.

Definition at line 200 of file bmp.c.

+ Here is the call graph for this function:

BMP_STATUS LCD_BMP_ReadHeader ( BMP bmp,
FIL *  f 
)

Reads the BMP file's header into the data structure.

Parameters
[out]bmpPointer to the bitmap data buffer.
[in]fPointer to the file structure.
Returns
BMP_OK if no error

Definition at line 362 of file bmp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

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.