Class

# FigureShape

<div class="rst-class">

forsearch

</div>

Shape

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to draw vector graphic shapes composed of lines and curves. It is similar to a polygon except that a “side” may be curved. A figure consists of a set of `CurveShapes</api/graphics/curveshape>`, with the end point of one curve automatically joined to the starting point of the next.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                       | Type                                   | Read-Only | Shared |
|--------------------------------------------|----------------------------------------|-----------|--------|
| `BorderColor<figureshape.bordercolor>`     | `Color</api/data_types/color>`         |           |        |
| `BorderOpacity<figureshape.borderopacity>` | `Double</api/data_types/double>`       |           |        |
| `BorderWidth<figureshape.borderwidth>`     | `Double</api/data_types/double>`       |           |        |
| `Count<figureshape.count>`                 | `Integer</api/data_types/integer>`     | ✓         |        |
| `FillColor<figureshape.fillcolor>`         | `Color</api/data_types/color>`         |           |        |
| `FillOpacity<figureshape.fillopacity>`     | `Double</api/data_types/double>`       |           |        |
| `Rotation<figureshape.rotation>`           | `Double</api/data_types/double>`       |           |        |
| `Scale<figureshape.scale>`                 | `Double</api/data_types/double>`       |           |        |
| `ValueAt<figureshape.valueat>`             | `CurveShape</api/graphics/curveshape>` |           |        |
| `X<figureshape.x>`                         | `Double</api/data_types/double>`       |           |        |
| `Y<figureshape.y>`                         | `Double</api/data_types/double>`       |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                       | Parameters                                                                                                                                                                                                                                                                                                                     | Returns                                | Shared |
|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|--------|
| `AddCubic<figureshape.addcubic>`           | x As `Single</api/data_types/single>`, y As `Single</api/data_types/single>`, x2 As `Single</api/data_types/single>`, y2 As `Single</api/data_types/single>`, cx As `Single</api/data_types/single>`, cy As `Single</api/data_types/single>`, cx2 As `Single</api/data_types/single>`, cy2 As `Single</api/data_types/single>` |                                        |        |
| `AddCurve<figureshape.addcurve>`           | curveShape As `CurveShape</api/graphics/curveshape>`                                                                                                                                                                                                                                                                           |                                        |        |
| `AddCurveAt<figureshape.addcurveat>`       | index As `Integer</api/data_types/integer>`, curveShape As `CurveShape</api/graphics/curveshape>`                                                                                                                                                                                                                              |                                        |        |
| `AddLine<figureshape.addline>`             | x As `Single</api/data_types/single>`, y As `Single</api/data_types/single>`, x2 As `Single</api/data_types/single>`, y2 As `Single</api/data_types/single>`                                                                                                                                                                   |                                        |        |
| `AddQuad<figureshape.addquad>`             | x As `Single</api/data_types/single>`, y As `Single</api/data_types/single>`, x2 As `Single</api/data_types/single>`, y2 As `Single</api/data_types/single>`, cx As `Single</api/data_types/single>`, cy As `Single</api/data_types/single>`                                                                                   |                                        |        |
| `CurveAt<figureshape.curveat>`             | index as `Integer</api/data_types/integer>`                                                                                                                                                                                                                                                                                    | `CurveShape</api/graphics/curveshape>` |        |
|                                            | index as `Integer</api/data_types/integer>`, `Assigns</api/language/assigns>` value As `CurveShape</api/graphics/curveshape>`                                                                                                                                                                                                  |                                        |        |
| `RemoveCurve<figureshape.removecurve>`     | curveShape As `CurveShape</api/graphics/curveshape>`                                                                                                                                                                                                                                                                           |                                        |        |
| `RemoveCurveAt<figureshape.removecurveat>` | index As `Integer</api/data_types/integer>`                                                                                                                                                                                                                                                                                    |                                        |        |

## Property descriptions

<div id="figureshape.bordercolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.BorderColor

**BorderColor** As `Color</api/data_types/color>`

> The color of the object's border.

<div id="figureshape.borderopacity">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.BorderOpacity

**BorderOpacity** As `Double</api/data_types/double>`

> Indicates the level of opacity.
>
> Degrees of transparency is currently supported only on macOS and Windows. On other platforms, the border is either visible (100%) or invisible.
>
> The following code adds a border to a \`FigureShape\`:
>
> ``` xojo
> Var a As New FigureShape
> a.BorderOpacity = 100
> g.DrawObject(a)
> ```

<div id="figureshape.borderwidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.BorderWidth

**BorderWidth** As `Double</api/data_types/double>`

> The width of the border, in points. The default is 1.
>
> The width a `Double</api/data_types/double>` value with a default of 1.0.

<div id="figureshape.count">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.Count

**Count** As `Integer</api/data_types/integer>`

> The number of `CurveShapes</api/graphics/curveshape>`.
>
> This property is read-only.
>
> ``` xojo
> Var fx As New FigureShape
> .
> .
> Label1.Text = fx.Count.ToString
> ```

<div id="figureshape.fillcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.FillColor

**FillColor** As `Color</api/data_types/color>`

> The color of the interior of the shape.

<div id="figureshape.fillopacity">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.FillOpacity

**FillOpacity** As `Double</api/data_types/double>`

> The opacity of the interior, from 0 (completely transparent) to 100 (opaque).
>
> This example sets the Fill to 50% opacity.
>
> ``` xojo
> Var a As New FigureShape
> a.BorderOpacity = 100
> a.BorderColor = Color.Black
> a.BorderWidth = 2.75
> a.FillOpacity = 50
> g.DrawObject(a)
> ```

<div id="figureshape.rotation">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.Rotation

**Rotation** As `Double</api/data_types/double>`

> Clockwise rotation, in radians, around the X, Y point. Only set the rotation after you have drawn all your objects.
>
> This code rotates the figure 0.9 radians.
>
> ``` xojo
> Var a As New FigureShape
> a.Rotation = 0.90
> a.BorderOpacity = 100
> a.BorderColor = Color.Black
> a.BorderWidth = 2.75
> g.DrawObject(a)
> ```

<div id="figureshape.scale">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.Scale

**Scale** As `Double</api/data_types/double>`

> The scaling factor relative to the object's original size.
>
> The following code rescales the figure by a factor of 1.5.
>
> ``` xojo
> Var a As New FigureShape
> a.Scale = 1.5
> a.Rotation = .90
> a.BorderOpacity = 100
> a.BorderColor = &c0000ff
> a.BorderWidth = 2.75
> g.DrawObject(a)
> ```

<div id="figureshape.valueat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.ValueAt

**ValueAt** As `CurveShape</api/graphics/curveshape>`

> Gets or sets the specified curve.
>
> The following gets the color of the first `CurveShape</api/graphics/curveshape>`.
>
> ``` xojo
> Var c As Color
> c = fx.ValueAt(0).FillColor
> ```

<div id="figureshape.x">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.X

**X** As `Double</api/data_types/double>`

> The horizontal position of the center or main anchor point.
>
> This example sets the horizontal position to 100 pixels from the left of the containing `Canvas</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> Var a As New FigureShape
> a.X = 100
> a.BorderOpacity = 100
> a.BorderColor = &c0000ff
> g.DrawObject(a)
> ```

<div id="figureshape.y">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.Y

**Y** As `Double</api/data_types/double>`

> The vertical position (down from top) position of the center or anchor point.
>
> This example moves the position of the shape down 100 pixels from the top of the containing `Canvas</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> Var a As New FigureShape
> a.Y = 100
> a.BorderOpacity = 100
> a.BorderColor = &c0000ff
> g.DrawObject(a)
> ```

## Method descriptions

<div id="figureshape.addcubic">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.AddCubic

**AddCubic**(x As `Single</api/data_types/single>`, y As `Single</api/data_types/single>`, x2 As `Single</api/data_types/single>`, y2 As `Single</api/data_types/single>`, cx As `Single</api/data_types/single>`, cy As `Single</api/data_types/single>`, cx2 As `Single</api/data_types/single>`, cy2 As `Single</api/data_types/single>`)

> Adds a cubic curve to the figure.
>
> The starting and ending points are *x*, *y* and *x2*, *y2*, respectively. This is a shortcut for adding a `CurveShape</api/graphics/curveshape>`. *cx*, *cy*, *cx2*, and *cy2* are the control points, ControlX(i) and ControlY(i) in a `CurveShape</api/graphics/curveshape>`.

<div id="figureshape.addcurve">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.AddCurve

**AddCurve**(curveShape As `CurveShape</api/graphics/curveshape>`)

> Adds the passed `CurveShape</api/graphics/curveshape>` to the figure.

<div id="figureshape.addcurveat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.AddCurveAt

**AddCurveAt**(index As `Integer</api/data_types/integer>`, curveShape As `CurveShape</api/graphics/curveshape>`)

> Adds the passed `CurveShape</api/graphics/curveshape>` at the position indicated by *index*.

<div id="figureshape.addline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.AddLine

**AddLine**(x As `Single</api/data_types/single>`, y As `Single</api/data_types/single>`, x2 As `Single</api/data_types/single>`, y2 As `Single</api/data_types/single>`)

> Adds a straight line to the figure.
>
> *x* and *y* are the starting coordinates; *x2* and *y2* are the end coordinates.
>
> The following example draws a triangle. The code is placed in the Paint event of a `Window</api/user_interface/desktop/desktopwindow>` or `Canvas</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> Var fx As New FigureShape
> fx.AddLine(0, 100, 50, 0)
> fx.AddLine(50, 0, -50, 0)
> fx.BorderOpacity = 100 ' opaque border
> fx.BorderColor = Color.Red
> fx.FillColor = Color.Yellow
> g.DrawObject(fx)
> ```

<div id="figureshape.addquad">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.AddQuad

**AddQuad**(x As `Single</api/data_types/single>`, y As `Single</api/data_types/single>`, x2 As `Single</api/data_types/single>`, y2 As `Single</api/data_types/single>`, cx As `Single</api/data_types/single>`, cy As `Single</api/data_types/single>`)

> Adds a quadratic curve to the figure.
>
> The starting and ending points are *x*, *y* and *x2*, *y2*, respectively. This is a shortcut for adding a `CurveShape</api/graphics/curveshape>`. *cx*, *cy*, *cx2*, and *cy2* are the control points, ControlX(i) and ControlY(i) in a `CurveShape</api/graphics/curveshape>`.

<div id="figureshape.curveat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.CurveAt

**CurveAt**(index As `Integer</api/data_types/integer>`) As `CurveShape</api/graphics/curveshape>`

> Returns the `CurveShape</api/graphics/curveshape>` at the *index* passed.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**CurveAt**(index As `Integer</api/data_types/integer>`, `Assigns</api/language/assigns>` value As `CurveShape</api/graphics/curveshape>`)

> Assigns the `value</api/graphics/curveshape>` to the *index* passed.

<div id="figureshape.removecurve">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.RemoveCurve

**RemoveCurve**(curveShape As `CurveShape</api/graphics/curveshape>`)

> Removes the specified curve.

<div id="figureshape.removecurveat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

FigureShape.RemoveCurveAt

**RemoveCurveAt**(index As `Integer</api/data_types/integer>`)

> Removes the curve at the specified *index*.

## Notes

A figure is formed by drawing each curve it contains in order, joining the endpoint of one to the starting point of the next. The figure is degenerate if doing so does not enclose any area. This will be the case for a figure containing only one line, for example. The appearance of a degenerate figure is undefined.

`AddLine<figureshape.addline>`, `AddCubic<figureshape.addcubic>`, and `AddQuad<figureshape.addquad>` are convenience methods that make it easier to add curves to the figure. You could instead create your own `CurveShapes</api/graphics/curveshape>`, and add them with the `AddCurve<figureshape.addcurve>` or `AddCurveAt<figureshape.addcurveat>` methods.

## Sample code

The following example draws a triangle. The code is placed in the Paint event of a `Window</api/user_interface/desktop/desktopwindow>` or `Canvas</api/user_interface/desktop/desktopcanvas>`.

``` xojo
Var fx As New FigureShape
fx.AddLine(0, 100, 50, 0)
fx.AddLine(50, 0, -50, 0)
fx.BorderOpacity = 100  ' opaque border
fx.BorderColor = Color.Red
fx.FillColor = Color.Yellow
g.DrawObject(fx)
```

## Compatibility

|                       |                       |
|-----------------------|-----------------------|
| **Project Types**     | Console, Desktop, Web |
| **Operating Systems** | All                   |

<div class="seealso">

`Object2D</api/graphics/object2d>` parent class; `ArcShape</api/graphics/arcshape>`, `CurveShape</api/graphics/curveshape>`, `FolderItem</api/files/folderitem>`, `Graphics</api/graphics/graphics>`, `Group2D</api/graphics/group2d>`, `Object2D</api/graphics/object2d>`, `OvalShape</api/graphics/ovalshape>`, `Picture</api/graphics/picture>`, `PixmapShape</api/graphics/pixmapshape>`, `RectShape</api/graphics/rectshape>`, `RoundRectShape</api/graphics/roundrectshape>`, `TextShape</api/graphics/textshape>` classes.

</div>
