c. Setting Screen Background with Bitmap/Tiled

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 09 - Setting Graphics Context >

c. Setting Screen Background with Bitmap/Tiled

This section shows how to set a screen background image using the SetBackgroundImage() command.

 

 

Command Prototype

 

uint16_t SetBackgroundImage(int16_t Handle, int16_t Mode)

 

Parameters

Description

Handle

Handle received from LoadImageFile() command

Mode

Centered or Zoomed or Tiled

 

 

Code

 

 

void setup()

{

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

 CleO.begin();

 

/* Get handle to an image */

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

 

/* Set screen background */

 CleO.SetBackgroundImage(h, TILED);

 

/* Release image handle */

 CleO.Free(h);

 

/* Start building a screen frame */

 CleO.Start();

 

/* Display completed screen frame */

 CleO.Show();

}

 

void loop() {}

 

 

Description

 

The above code snippet shows how the SetBackgroundImage() command is used to set the screen background image in tiled mode.

Start() and Show() commands are used to draw a frame on the screen.

 

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 -

 

ScreenBackgroundImage