c. Drawing Strings with Parameters

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 02 - Drawing Strings >

c. Drawing Strings with Parameters

This section shows how to draw text with different string parameters such as Handle, Color, Justification, etc. using the CleO Graphic Primitives command StringExt().

 

 

Command Prototype

 

uint16_t StringExt(int16_t Handle, int X, int Y, uint32_t Color, just_t Justification, int16_t Angle, int Radius, const char* String)

 

Parameters

Description

Handle

Font Size

X

x-coordinate for string

Y

y-coordinate for string

Color

String color

Justification

Justification values (i.e MM,TL,BL, etc.)

Angle

Angle at which string will be drawn

Radius

Distance from center at which string will be drawn

String

String text

 

 

Code

 

 

void setup()

{

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

 CleO.begin();

 

 /* Start building a screen frame */

 CleO.Start();

 

 /* Draw a string "Hello world" in light green color, at (x, y) = (400, 240), with 0 angle and radius, with medium size font*/

 CleO.StringExt(FONT_MEDIUM, 400, 240, LIGHT_GREEN, MM, 0, 0, "Hello world");

 

 /* Display completed screen frame */

 CleO.Show();

 

 

Description

 

The above code snippet draws a string "Hello World" in light green color at the center of the screen with an angle and radius of 0 with a huge font size.

 

 

Output

 

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

 

Tutorials02-DrawingStrings.50