# Shapes

> Source: https://manual.pvxplus.com/pxplus-user-guide/graphical-user-interfaces/display-objects/shapes

The graphical shapes that are available to PxPlus include the **[Arc](https://manual.pvxplus.com/pxplus-user-guide/graphical-user-interfaces/display-objects/shapes#arc)**, **[Pie](https://manual.pvxplus.com/pxplus-user-guide/graphical-user-interfaces/display-objects/shapes#pie)**, **[Circle](https://manual.pvxplus.com/pxplus-user-guide/graphical-user-interfaces/display-objects/shapes#circle)**, **[Line](https://manual.pvxplus.com/pxplus-user-guide/graphical-user-interfaces/display-objects/shapes#line)**, **[Rectangle](https://manual.pvxplus.com/pxplus-user-guide/graphical-user-interfaces/display-objects/shapes#rectangle)** and **[Polygon](https://manual.pvxplus.com/pxplus-user-guide/graphical-user-interfaces/display-objects/shapes#polygon)**. All of these shapes use the current attributes for the **'[PEN](https://manual.pvxplus.com/mnemonics/pen)'** and **'[FILL](https://manual.pvxplus.com/mnemonics/fill)'** mnemonics to determine their outline and fill characteristics.

## Pen Style

**'PEN'**(*style,width,colour*)

Defines the pen style to outline subsequently drawn shapes. Styles include:

```
0 - No pen
1 - Solid pen
2 - Dashed line
3 - Dotted line
4 - Dash-dot
5 - Dash-dot-dot
```

Width is in graphical units. Colour can be a colour code (0 - 15) or the name of one of the PxPlus standard colours, the name of a user-defined colour, or an RGB setting (**RGB:** *n n n*). PxPlus colour codes/names are as follows:

|  |  |
| --- | --- |
| ```<br>0 - Black<br>1 - Light Red<br>2 - Light Green<br>3 - Light Yellow<br>4 - Light Blue<br>5 - Light Magenta<br>6 - Light Cyan<br>7 - White<br>``` | ```<br> 8 - Dark Gray<br> 9 - Dark Red<br>10 - Dark Green<br>11 - Dark Yellow<br>12 - Dark Blue<br>13 - Dark Magenta<br>14 - Dark Cyan<br>15 - Gray<br>``` |

For syntax details, see **'[PEN](https://manual.pvxplus.com/mnemonics/pen)'** mnemonic.

***Example:***

```
PRINT 'PEN'(1,10,6),
PRINT 'PEN'(1,1,"RGB: 192,192,192"),
PRINT 'PEN'(0,3,"Light Red"),
```

Note:  
The current 'PEN' and 'FILL' settings are reset after a ['CS'](https://manual.pvxplus.com/mnemonics/cs) (Clear Screen) mnemonic has been output.

## Fill Pattern

**'FILL'**(*pattern*, *colour1* \[*,colour2*\])

Defines the fill pattern to be used with subsequently drawn shapes. Two types of fill patterns are available: *Standard* and *Gradient.*

*Standard* patterns include:

```
0 - No fill
1 - Solid fill
2 - Horizontal lines
3 - Vertical lines
4 - Crossed lines
5 - Diagonal bottom left to top right
6 - Diagonal top left to bottom right
7 - Diagonal crossed lines
```

Patterns 4 and 7 require two colours to be specified, the first for the lines and the second for the background.

*Gradient* patterns include:

```
2 - Top to bottom
3 - Left to right
5 - Top left to bottom right
6 - Bottom left to top right
```

Two colours must be specified for a gradient pattern, with the direction being derived from the code. Colours can be a colour code (0-15) or the name of one of the PxPlus standard colours (see **'[PEN](https://manual.pvxplus.com/pxplus-user-guide/graphical-user-interfaces/display-objects/shapes#pen)'** above), the name of a user-defined colour, or an RGB setting (**RGB:** *n n n*). If a second colour is specified, then both colours must be specified using the same format.

For syntax details, see **'[FILL](https://manual.pvxplus.com/mnemonics/fill)'** mnemonic.

***Example:***

```
PRINT 'FILL'(1,"RGB: 192,192,192"),
PRINT 'FILL'(0,"Light Red"),
PRINT 'FILL'(3,"UserColour32","UserColour51"),
```

## Arc

**'ARC'**(*x,y,radius,aspect,angle_1,angle_2*)

Draws an arc centred at the given *x* and *y* graphical coordinates with the specified radius (also in graphical units) that extends from starting *angle_1* to *angle_2.* If an aspect ratio other than 1 is specified, then the arc is tilted into an elliptical shape. Since an arc is not a closed figure, fill patterns do not apply.

For syntax details, see **'[ARC](https://manual.pvxplus.com/mnemonics/arc)'** mnemonic.

***Example:***

```
PRINT 'PEN'(1,2,1),'ARC'(400,200,100,1,0,120),
```

## Pie

**'PIE'**(*x,y,radius,aspect,angle_1,angle_2*)

Draws a pie slice centred at the given *x* and *y* graphical coordinates with the specified radius (also in graphical units) that extends from starting *angle_1* to *angle_1.* If an aspect ratio other than 1 is specified, then the pie is tilted into an elliptical shape.

For syntax details, see **'[PIE](https://manual.pvxplus.com/mnemonics/pie)'** mnemonic.

***Example:***

```
PRINT 'PEN'(0,0,0),'FILL'(1,3),'PIE'(400,200,100,1,45,0),
```

## Circle

**'CIRCLE'**(*x,y,radius,aspect*)

Draws a circle centred at the given *x* and *y* graphical coordinates with the specified radius (also in graphical units). If an aspect ratio other than 1 is used, then the circle is tilted into an elliptical shape.

For syntax details, see **'[CIRCLE](https://manual.pvxplus.com/mnemonics/circle)'** mnemonic.

***Example:***

```
PRINT 'PEN'(1,3,1),'FILL'(2,6),'CIRCLE'(224,450,90),
```

## Line

**'LINE'**(*x1,y1,x2,y2* \[*,x,y* …\])

Draws a line (or lines) joining the sequential pairs of *x* and *y* graphical coordinates. Fill patterns do not apply to lines.

For syntax details, see **'[LINE](https://manual.pvxplus.com/mnemonics/line)'** mnemonic.

***Example:***

```
PRINT 'PEN'(1,3,1),'LINE'(0,@y(5),@x(80),@y(5)),
```

## Polygon

**'POLYGON'**(*x,y,x,y,x,y* …)

Draws a polygon by joining the sets of *x/y* graphical coordinates.

For syntax details, see **'[POLYGON](https://manual.pvxplus.com/mnemonics/polygon)'** mnemonic.

***Example:***

```
PRINT 'PEN'(1,3,8),'FILL'(2,6),
PRINT 'POLYGON'(224,450,100,100,400,200,390,390),
```

This example creates an irregular four-sided figure by setting the coordinates for the four corners.

## Rectangle

**'RECTANGLE'**(*x1,y1,x2,y2,* \[*radius*\])

Draws a rectangle defined by two sets of *x/y* graphical coordinates. An optional radius may be specified as a rounding factor for the corners.

For syntax details, see **'[RECTANGLE](https://manual.pvxplus.com/mnemonics/rectangle)'** mnemonic.

***Example:***

```
PRINT 'PEN'(1,3,8),'FILL'(4,6,8),
PRINT 'RECTANGLE'(100,100,400,600),
PRINT 'RECTANGLE'(700,100,820,220,30),
```

## Display Object Sampler

This simple code illustrates the variety of graphical user interface **[Display Objects](https://manual.pvxplus.com/pxplus-user-guide/graphical-user-interfaces/display-objects/overview)**.

```
PRINT 'DIALOGUE'(0,0,80,25,"Shapes"),'SR','CS',
panelWidth=@X(MXC(0)+1)
panelHeight=@Y(MXL(0)+1)
PRINT 'PEN'(0,0,0),'FILL'(2,4,6),
PRINT 'RECTANGLE'(0,@Y(0),panelWidth,panelHeight),
PRINT 'FONT'("Arial",3,"BI"),
PRINT 'TEXT'(@X(2),@Y(9.5),"Shapes"),
PRINT 'PEN'(1,3,2),
PRINT 'ARC'(@X(10),@Y(18),@X(5),1,0,180),
PRINT 'PEN'(1,2,3),'FILL'(1,3),
PRINT 'PIE'(@X(25),@Y(18),@X(5),1,25,340),
PRINT 'PEN'(1,1,0),'FILL'(2,2,10),
PRINT 'CIRCLE'(@X(40),@Y(18),@X(5),1),
PRINT 'PEN'(1,3,5),
PRINT 'LINE'(@X(50),@Y(15),@X(60),@Y(15),@X(50),@Y(21),@X(60),@Y(21)),
PRINT 'PEN'(1,3,7),'FILL'(4,7,1),
PRINT 'POLYGON'(@X(65),@Y(18),@X(68),@Y(15),@X(72),@Y(15),@X(75),@Y(18),@X(72),@Y(21),@X(68),@Y(21)),
OBTAIN *
PRINT 'POP',
```

![](https://manual.pvxplus.com/migration-assets/343ebe73e5c0440deacb4403e3a6407ddbebc27532a2d8cdc7727cfca913cb9e.jpg)
