Class

# GraphicsPath

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

## Description

A graphics path is a mathematical description of a series of shapes or lines.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                      | Type                                        | Read-Only | Shared |
|-------------------------------------------|---------------------------------------------|-----------|--------|
| `CurrentPoint<graphicspath.currentpoint>` | `Point</api/graphics/point>`                | ✓         |        |
| `Handle<graphicspath.handle>`             | `Ptr</api/data_types/additional_types/ptr>` | ✓         |        |
| `IsEmpty<graphicspath.isempty>`           | `Boolean</api/data_types/boolean>`          | ✓         |        |
| `IsRectangle<graphicspath.isrectangle>`   | `Boolean</api/data_types/boolean>`          | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                              | Parameters                                                                                                                                                                                                                                                                       | Returns                            | Shared |
|-------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|--------|
| `AddArc<graphicspath.addarc>`                                     | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, radius As `Double</api/data_types/double>`, startRadian As `Double</api/data_types/double>`, endRadian As `Double</api/data_types/double>`, counterClockwise As `Boolean</api/data_types/boolean>` |                                    |        |
| `AddCurveToPoint<graphicspath.addcurvetopoint>`                   | cp1x As `Double</api/data_types/double>`, cp1y As `Double</api/data_types/double>`, cp2X As `Double</api/data_types/double>`, cp2Y As `Double</api/data_types/double>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                             |                                    |        |
| `AddLineToPoint<graphicspath.addlinetopoint>`                     | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                                                                                                                                                                                                     |                                    |        |
| `AddQuadraticCurveToPoint<graphicspath.addquadraticcurvetopoint>` | cpX As `Double</api/data_types/double>`, cpY As `Double</api/data_types/double>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                                                                                                                   |                                    |        |
| `AddRectangle<graphicspath.addrectangle>`                         | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                              |                                    |        |
|                                                                   | r As `Rect</api/graphics/rect>`                                                                                                                                                                                                                                                  |                                    |        |
| `AddRoundRectangle<graphicspath.addroundrectangle>`               | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`           |                                    |        |
|                                                                   | r As `Rect</api/graphics/rect>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`                                                                                                                                               |                                    |        |
| `Bounds<graphicspath.bounds>`                                     |                                                                                                                                                                                                                                                                                  | `Rect</api/graphics/rect>`         |        |
| `Contains<graphicspath.contains>`                                 | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                                                                                                                                                                                                     | `Boolean</api/data_types/boolean>` |        |
|                                                                   | pt As `Point</api/graphics/point>`                                                                                                                                                                                                                                               | `Boolean</api/data_types/boolean>` |        |
| `MoveToPoint<graphicspath.movetopoint>`                           | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                                                                                                                                                                                                     |                                    |        |

## Property descriptions

<div id="graphicspath.currentpoint">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.CurrentPoint

**CurrentPoint** As `Point</api/graphics/point>`

> The point at which the next drawing will take place.
>
> This property is read-only.
>
> Drawing methods like `AddLineToPoint<graphicspath.addlinetopoint>` will change the CurrentPoint. `MoveToPoint<graphicspath.movetopoint>` also changes the CurrentPoint.

<div id="graphicspath.handle">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> A pointer to the object for use with `declares</api/language/declare>`.
>
> This property is read-only.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is currently only supported for Android.
>
> </div>

<div id="graphicspath.isempty">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.IsEmpty

**IsEmpty** As `Boolean</api/data_types/boolean>`

> Checks if the path is empty. An empty path contains no elements.
>
> This property is read-only.

<div id="graphicspath.isrectangle">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.IsRectangle

**IsRectangle** As `Boolean</api/data_types/boolean>`

> Checks if the path is a rectangle.
>
> This property is read-only.

## Method descriptions

<div id="graphicspath.addarc">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.AddArc

**AddArc**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, radius As `Double</api/data_types/double>`, startRadian As `Double</api/data_types/double>`, endRadian As `Double</api/data_types/double>`, counterClockwise As `Boolean</api/data_types/boolean>`)

> Adds an arc to the path.
>
> The ending point of the Arc becomes the start point for the next element added to the path. In particular, if you add two arcs in a row, there will be a line that connects the ending point of the first arc to the starting point of the second arc. If you do not want this behavior, set the new starting point manually using MoveToPoint.
>
> Draw an arc that is 1/4 of a circle:
>
> ``` xojo
> Const Pi = 3.14159
> Var arc As New GraphicsPath
> arc.AddArc(50, 50, 20, 0, Pi / 2, False)
> g.DrawPath(arc)
> ```

<div id="graphicspath.addcurvetopoint">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.AddCurveToPoint

**AddCurveToPoint**(cp1x As `Double</api/data_types/double>`, cp1y As `Double</api/data_types/double>`, cp2X As `Double</api/data_types/double>`, cp2Y As `Double</api/data_types/double>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Adds a cubic Bézier curve to the point in the path.
>
> Draw a cloud:
>
> ``` xojo
> Var curve As New GraphicsPath
> curve.MoveToPoint(20, 20)
> curve.AddCurveToPoint(20, 100, 200, 100, 200, 20)
> g.DrawPath(curve)
>
> ' Draw a fluffy white cloud
> Var cloud As New GraphicsPath
> cloud.MoveToPoint(170, 80)
> cloud.AddCurveToPoint(130, 100, 130, 150, 230, 150)
> cloud.AddCurveToPoint(250, 180, 320, 180, 340, 150)
> cloud.AddCurveToPoint(420, 150, 420, 120, 390, 100)
> cloud.AddCurveToPoint(430, 40, 370, 30, 340, 50)
> cloud.AddCurveToPoint(320, 5, 250, 20, 250, 50)
> cloud.AddCurveToPoint(200, 5, 150, 20, 170, 80)
>
> g.DrawingColor = &c0000FF
> g.PenSize = 5
> g.DrawPath(cloud)
> ```

<div id="graphicspath.addlinetopoint">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.AddLineToPoint

**AddLineToPoint**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Draws a line from the `CurrentPoint<graphicspath.currentpoint>` to the specified point.
>
> Draw a triangle:
>
> ``` xojo
> Var p As New GraphicsPath
> p.MoveToPoint(10, 5) ' Start location
> p.AddLineToPoint(40, 40)
> p.AddLineToPoint(5, 60)
>
> g.DrawingColor = &c0000FF
> g.DrawPath(p, True)
>
> ' Use FillPath to draw a filled triangle
> ```

<div id="graphicspath.addquadraticcurvetopoint">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.AddQuadraticCurveToPoint

**AddQuadraticCurveToPoint**(cpX As `Double</api/data_types/double>`, cpY As `Double</api/data_types/double>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Adds a quadratic Bézier curve to the point in the path.
>
> Draw a curve:
>
> ``` xojo
> Var qCurve As New GraphicsPath
> qCurve.MoveToPoint(38, 150)
> qCurve.AddQuadraticCurveToPoint(138, 0, 238, 150)
>
> g.PenSize = 10
> g.DrawPath(qCurve)
> ```

<div id="graphicspath.addrectangle">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.AddRectangle

**AddRectangle**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

> Adds a rectangle to the path.
>
> A simple rectangle:
>
> ``` xojo
> Var rect As New GraphicsPath
>
> rect.AddRectangle(10, 10, 100, 150)
> g.DrawPath(rect)
> ```

**AddRectangle**(r As `Rect</api/graphics/rect>`)

> Adds a rectangle to the path based on the passed `Rect</api/graphics/rect>` *r*.
>
> A simple rectangle:
>
> ``` xojo
> Var rect As New Rect(10, 10, 100, 150)
> Var path As New GraphicsPath
>
> path.AddRectangle(rect)
> g.DrawPath(path)
> ```

<div id="graphicspath.addroundrectangle">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.AddRoundRectangle

**AddRoundRectangle**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`)

> Adds a rounded rectangle to the path.
>
> A simple rounded rectangle:
>
> ``` xojo
> Var rect As New GraphicsPath
>
> rect.AddRoundRectangle(10, 10, 100, 150, 10, 10)
> g.DrawPath(rect)
> ```

**AddRoundRectangle**(r As `Rect</api/graphics/rect>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`)

> Adds a rounded rectangle to the path based on the passed `Rect</api/graphics/rect>` *r*.
>
> A simple rounded rectangle:
>
> ``` xojo
> Var rect As New Rect(10, 10, 100, 150)
> Var path As New GraphicsPath
>
> path.AddRoundRectangle(rect, 10, 10)
> g.DrawPath(path)
> ```

<div id="graphicspath.bounds">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.Bounds

**Bounds** As `Rect</api/graphics/rect>`

> Returns the boundary of the <span class="title-ref">GraphicsPath</span>.

<div id="graphicspath.contains">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.Contains

**Contains**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the coordinates passed are within bounds of the <span class="title-ref">GraphicsPath</span>.

**Contains**(pt As `Point</api/graphics/point>`) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the point passed is within bounds of the <span class="title-ref">GraphicsPath</span>.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> If you want to use Contains, make sure to set the *X* and *Y* properties and **do not** pass the these to the `Graphics.DrawObject<graphics.drawobject>` method. `Graphics.DrawObject<graphics.drawobject>` parameters are the offset where the object will be drawn.
>
> </div>

<div id="graphicspath.movetopoint">

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

</div>

<div class="rst-class">

forsearch

</div>

GraphicsPath.MoveToPoint

**MoveToPoint**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Moves to the point without drawing anything.
>
> ``` xojo
> Var p As New GraphicsPath
> p.MoveToPoint(50, 50)
> ```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `Canvas</api/user_interface/desktop/desktopcanvas>` control; `Window</api/user_interface/desktop/desktopwindow>`, `DesktopContainer</api/user_interface/desktop/desktopcontainer>` classes, `Graphics.DrawPath<graphics.drawpath>`, `Graphics.FillPath<graphics.fillpath>` methods

</div>
