SAMV71 Xplained Ultra Software Package 1.5

bmp.c File Reference

#include "board.h"
#include <string.h>

Go to the source code of this file.

Data Structures

struct  BMPPaletteEntry

Defines

#define IMAGE_OFFSET   0x100
 BMP offset for header.

Functions

uint8_t BMP_IsValid (void *file)
 Test if BMP is valid.
uint32_t BMP_GetFileSize (void *file)
 Returns the size of a BMP image given at least its header (the file does not have to be complete).
void WriteBMPheader (uint32_t *pAddressHeader, uint32_t bmpHSize, uint32_t bmpVSize, uint8_t nbByte_Pixels)
 Write a BMP header.
void BMP_displayHeader (uint32_t *pAddressHeader)
 Debug function, dislay BMP header.
uint8_t BMP_Decode (void *file, uint8_t *buffer, uint32_t width, uint32_t height, uint8_t bpp)
 Loads a BMP image located at the given address, decodes it and stores the resulting image inside the provided buffer. Image must have the specified width & height. If no buffer is provided, this function simply checks if it is able to decode the image.
void RGB565toBGR555 (uint8_t *fileSource, uint8_t *fileDestination, uint32_t width, uint32_t height, uint8_t bpp)
 Convert RGB 565 to RGB 555 (RGB 555 is adapted to LCD).

Detailed Description

Definition in file bmp.c.


Function Documentation

uint8_t BMP_Decode ( void *  file,
uint8_t *  buffer,
uint32_t  width,
uint32_t  height,
uint8_t  bpp 
)

Loads a BMP image located at the given address, decodes it and stores the resulting image inside the provided buffer. Image must have the specified width & height. If no buffer is provided, this function simply checks if it is able to decode the image.

Parameters:
file Buffer which holds the BMP file.
buffer Buffer in which to store the decoded image.
width Buffer width in pixels.
height Buffer height in pixels.
bpp Number of bits per pixels that the buffer stores.
Returns:
0 if the image has been loaded; otherwise returns an error code.

Definition at line 172 of file bmp.c.

Here is the call graph for this function:

void BMP_displayHeader ( uint32_t *  pAddressHeader  ) 

Debug function, dislay BMP header.

Parameters:
pAddressHeader Address of the BMP

Definition at line 130 of file bmp.c.

uint32_t BMP_GetFileSize ( void *  file  ) 

Returns the size of a BMP image given at least its header (the file does not have to be complete).

Parameters:
file Pointer to the buffer which holds the BMP file.
Returns:
size of BMP image

Definition at line 80 of file bmp.c.

uint8_t BMP_IsValid ( void *  file  ) 

Test if BMP is valid.

Parameters:
file Buffer holding the file to examinate.
Returns:
1 if the header of a BMP file is valid; otherwise returns 0.

Definition at line 69 of file bmp.c.

void RGB565toBGR555 ( uint8_t *  fileSource,
uint8_t *  fileDestination,
uint32_t  width,
uint32_t  height,
uint8_t  bpp 
)

Convert RGB 565 to RGB 555 (RGB 555 is adapted to LCD).

Parameters:
fileSource Buffer which holds the RGB file
fileDestination Buffer in which to store the decoded image
width Buffer width in pixels.
height Buffer height in pixels.
bpp Number of bits per pixels that the buffer stores.

Definition at line 283 of file bmp.c.

void WriteBMPheader ( uint32_t *  pAddressHeader,
uint32_t  bmpHSize,
uint32_t  bmpVSize,
uint8_t  nbByte_Pixels 
)

Write a BMP header.

Parameters:
pAddressHeader Begin address of the BMP
bmpHSize BMP heigth size
bmpVSize BMP width size
bmpRgb Type of BMP (YUV or RGB)
nbByte_Pixels Number of byte per pixels

Definition at line 93 of file bmp.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines