d. Bitmap Rotation

<< Click to Display Table of Contents >>

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

d. Bitmap Rotation

This section shows how to rotate the bitmaps at various angles on justification using the BitmapTransform() command.



Command Prototype


uint16_t BitmapTransform(int Scale, int16_t Rotate);





decides the scaling value, 1 indicates no scaling


angle of rotation






void setup()


 int centerX = 800 / 2, centerY = 480 / 2;


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



/* Get the handle by loading bitmap */

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


/* Start building a screen frame */



 CleO.StringExt(FONT_MEDIUM, centerX, 50, LIGHT_GREEN, MM, 0, 0,"30 degrees rotation");

 CleO.StringExt(FONT_MEDIUM, centerX, 425, LIGHT_GREEN, MM, 0, 0, "MM Justification");


/* Draw bitmap at 30 degrees rotation with MM justification */


 CleO.BitmapTransform(1, 30);

 CleO.Bitmap(handle, centerX, centerY);


/* Draw a point at bitmap justification for a reference */



 CleO.Point(centerX, centerY);


/* Display completed screen frame */




void loop() { }





The above code snippet uses the BitmapJustification() command to select the justification.

The BitmapTransform() command rotates the bitmap on this rationale.

Since there is no change to the scaling of the bitmap, value one is passed as a parameter to the BitmapTransform() command.

A point is drawn as a reference to show the center of rotation.

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


Note: The range is from (minimum) 1/8th of the bitmap size and it is up to (maximum) 256 times of the bitmap size.





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