b. Drawing Lines with Parameters

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 04 - Drawing Lines >

b. Drawing Lines with Parameters

This section shows how to draw a line with width and color parameters using the commands LineWidth() and LineColor().

 

 

Command Prototype

 

uint16_t LineWidth(int Width)

 

Parameters

Description

Width

Line width in pixels

 

uint16_t LineColor(uint32_t argb)

 

Parameters

Description

argb

Color values (for example - red, yellow, green etc.)

 

 

Code

 

 

void setup()

{

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

 CleO.begin();

 

 /* Start building a screen frame */

 CleO.Start();

 

 /* select line width - 8 */

 CleO.LineWidth(8);

 

/* select line color - yellow */

 CleO.LineColor(YELLOW);

 

 /* draw a line on screen connecting two points (10, 10) & (310, 470) */

 CleO.Line(10, 10, 310, 470);

 

 /* Display completed screen frame */

 CleO.Show();

}

 

void loop() { }

 

 

Description

 

The above code snippet draws a line that starts at (10,10) and ends at (310,470) with line width 8 and color yellow.

 

Note: The range is from 1 - 255 pixels.

 

 

Output

 

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

 

LineParametersColorWidth