b. Bitmap Types

<< Click to Display Table of Contents >>

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

b. Bitmap Types

CleO supports three types of bitmaps, namely BMP (Bitmap Image File Format), PNG (Portable Network Graphics file format) and JPG/JPEG (file format from Joint Photographic Experts Group). LoadImageFile() command is used to load the various types of bitmap files.

 

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();

 

/* Start building a screen frame */

 CleO.Start();

 

/* Get the handle for JPEG, BMP and PNG bitmap files */

 int16_t hJPEG = CleO.LoadImageFile("@Pictures/speaker.jpg", 0);

 int16_t hBMP = CleO.LoadImageFile("@Pictures/Spectrum/15.bmp", 0);

 int16_t hPNG = CleO.LoadImageFile("@Pictures/ball.png", 0);

 

  CleO.BitmapJustification(ML);

 CleO.StringExt(FONT_MEDIUM, 350, 40, LIGHT_GREEN, MR, 0, 0, "JPEG Bitmap");

 

/* Draw a bitmap at (450, 40) using hJPEG handle */

  CleO.Bitmap(hJPEG, 450, 40);

  CleO.StringExt(FONT_MEDIUM, 350, 240, LIGHT_GREEN, MR, 0, 0, "BMP Bitmap");

 

/* Draw a bitmap at (450, 240) using hBMP handle */

 CleO.Bitmap(hBMP, 450, 240);

 CleO.StringExt(FONT_MEDIUM, 350, 440, LIGHT_GREEN, MR, 0, 0, "PNG Bitmap");

 

/* Draw a bitmap at (450, 440) using hPNG handle */

 CleO.Bitmap(hPNG, 450, 440);

 

/* Display completed screen frame */

 CleO.Show();

}

 

void loop() { }

 

 

Description

 

In the above code, the LoadImageFile() command provides the handles for various types of bitmap files to be used to perform various operations (such as animating bitmaps, scaling bitmaps, etc.) on these bitmap files.

 

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 -

 

Tutorials03-BitmapTypes.50