f. Drawing Needle Segments with Parameters

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 08 - Drawing Needles >

f. Drawing Needle Segments with Parameters

This section shows how to draw needle segments with parameters such as color, radius, width, etc., using the CleO commands.

 

 

Command Prototype:

 

uint16_t CircleExt(int X, int Y, int Radius1, int Radius2, uint32_t Color, just_t Justification, int16_t Angle, int Radiusat)

uint16_t Needle(int X1, int Y1, int X2, int Y2)

uint16_t NeedleWidth(int Width)

uint16_t NeedleColor(uint32_t argb)

uint16_t NeedleXY(int X, int Y, int Length, int16_t Angle)

uint16_t NeedleR1R2(int X, int Y, int Radius1, int Radius2, int16_t Angle)

 

Parameters

Description

X, Y

(x,y) coordinates

X1 Y1

(x1,y1) coordinate, start point of the needle

X2 Y2

(x2,y2) coordinate, end point of the needle

Width

Needle width

argb

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

Radius1

Inner radius

Radius2

Outer radius

Color

Needle Color

Justification

Justification of the needle

Angle

angle at which needle will be drawn

Radiusat

Distance from center

Length

Needle length

 

 

Code

 

 

void setup()

{

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

 CleO.begin();

 

 /* Start building a screen frame */

 CleO.Start();

 

 int cx = 320 / 2;

 int cy = 480 / 2;

 

 CleO.CircleExt(cx, cy, 0, 160, DARK_GREY, MM, 0, 0);

 

 CleO.NeedleWidth(20);

 

 CleO.NeedleColor(RED);

 CleO.Needle(10, 30, 310, 30);

 CleO.Needle(310, 60, 10, 60);

 

 /* Draw white needle of length 160 at 0 angle */

 CleO.NeedleColor(WHITE);

 CleO.NeedleXY(cx, cy, 160, 0);

 

 /* Draw dark green needle at 120 angle */

 CleO.NeedleColor(DARK_GREEN);

 CleO.NeedleR1R2(cx, cy, 30, 160, 120);

 

/* Draw pink needle at 240 angle */

 CleO.NeedleColor(PINK);

 CleO.NeedleR1R2(cx, cy, -30, 160, 240);

 

 /* Display completed screen frame */

 CleO.Show();

}

 

void loop()

{

}

 

 

Description

 
The above code snippet draws a set of needles with different parameters such as length, width, angle, radius and color.

 

 

Output

 

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

 

NeedleSegmentParameters