a. Loading Bitmap Files

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 03 - Displaying Bitmaps & Icons >

a. Loading Bitmap Files

To draw an image using bitmap, you are required to load the bitmap file and get the handle. This section shows how to load a bitmap file and get the handle that can be passed to the Bitmap() command to draw an image. LoadImageFile() is the command used to load the picture file.

 

 

Command Prototype

 

uint16_t LoadImageFile(const char* FileName, int16_t Format);

 

Parameters

Description

FileName

Absolute path of bitmap file

Format

0 - reserved

 

 

Code

 

 

void setup()

{

 /* Initialize CleO - needs to be done only once */

 CleO.begin();

 

/* Get the handle for the image */

 int16_t im = CleO.LoadImageFile("@Pictures/ctg.jpg", 0);

 

/* Start building a screen frame */

 CleO.Start();

 

/* Draw a bitmap at (0, 0) using im handle */

 CleO.Bitmap(im, 0, 0);

 

/* Display completed screen frame */

 CleO.Show();

}

 

void loop()

{

}

 

 

Description

 

In the above code snippet, after calling LoadImageFile() command, a handle (im) will be generated for use with other functions to perform various operation on the bitmap file "ctg.jpg."

 

Use the @ symbol only when performing the file operation from the eFlash and not from the SD Card.

 

 

Output

 

Here is the output displayed upon executing the above code snippet -

 

Loading Image Files