a. Drawing Simple Rectangle

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 07 - Drawing Rectangles >

a. Drawing Simple Rectangle

This section shows how to draw a simple rectangle using the RectangleXY() command.

 

 

Command Prototype

 

uint16_t RectangleXY(int X,int Y,int Width,int Height)

 

Parameters

Description

X,Y

(x,y) coordinates depends on the rectangle justification (For example, with MM justification, the x,y coordinates will be at the center of the rectangle).

Width

width in pixels

Height

height in pixels

 

 

Code

 

 

void setup()

{

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

 CleO.begin();

 

/* Start building a screen frame */

 CleO.Start();

 CleO.RectangleJustification(MM);

 

/* Draw a white rectangle at (160, 240) point with 200 width, 400 height */

 CleO.RectangleXY(160, 240, 200, 400);

 

/* Display completed screen frame */

 CleO.Show();

}

 

void loop()

{

}

 

 

Description

 

The above code snippet draws a simple rectangle at (160, 240) with MM justification.

 

 

Output

 

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

 

DrawingRectangles