c. Drawing Rectangles with Rounded Corners

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 07 - Drawing Rectangles >

c. Drawing Rectangles with Rounded Corners

This section shows how to draw a rectangle with rounded corners using the command RectangleCorner().

 

 

Command Prototype

 

uint16_t RectangleCorner(int Radius)

 

Parameters

Description

Radius

radius of the rectangle

 

 

Code

 

 

void setup()

{

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

 CleO.begin();

 

/* Start building a screen frame */

 CleO.Start();

 CleO.RectangleJustification(MM);

 

/* set the rectangle corner radius */

 CleO.RectangleCorner(20);

 

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

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

 

/* Display completed screen frame */

 CleO.Show();

}

 

void loop()

{

}

 

 

Description

 

The above code snippet draws a white color rectangle (which is the default color) with a rounded corner with radius set to 20.

 

Note: The range is from 1 - 255 pixels.

 

 

Output

 

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

 

Tutorials07-DrawingRectanglesWithRoundedCorners.50