c. Bitmap Justification Parameters

<< Click to Display Table of Contents >>

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

c. Bitmap Justification Parameters

CleO currently supports nine different justifications for the bitmap, namely -


1.TL - Top Left

2.TM - Top Middle

3.TR - Top Right

4.ML - Middle Left

5.MM - Middle Middle

6.MR - Middle Right

7.BL - Bottom Left

8.BM - Bottom Middle

9.BB - Bottom Bottom

10.BR - Bottom Right


The Default justification is TL - Top Left.


Note: Bottom Right (BR) and Bottom Bottom (BB) are equivalent of each other.


To draw an image using a bitmap file, you are required to load the bitmap file first and get the handle. The following command prototype is used to select the desired justification. Bitmap() command is used to draw a bitmap at (x,y) location.



Command Prototype


uint16_t BitmapJustification(just_t Justification);





Top Left (TL), Top Middle (TM), Top Right (TR), Middle Left (ML), Middle Middle (MM), Middle Right (MR), Bottom Left (BL), Bottom Middle (BM) or Bottom Bottom (BB)


uint16_t Bitmap(int16_t Handle, int X, int Y)





returns value from LoadImageFile() commmand


x coordinate value


y coordinate value






void setup()


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



/* Get the handle for the image */

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


/* Start building a screen frame */



 /* Select MM as a justification for bitmap drawing */



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

 CleO.Bitmap(im, 150, 200);


/* Display completed screen frame */




void loop() { }





In the above sample code snippet, the bitmap justification is set at MM using the BitmapJustification() command. A Bitmap is drawn using Bitmap() command at (150, 200) coordinate on the screen. Different values of justification may be tried using the BitmapJustification() command to see its effect on the bitmap drawing.


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





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



The sample screen shot below shows different bitmap justification locations -