---
name: "wxGraphicsPath"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/wxGraphicsPath"
---

# wxGraphicsPath(3erl)

Functions for wxGraphicsPath class

## NAME

wxGraphicsPath - Functions for wxGraphicsPath class

## DESCRIPTION

A *wxGraphicsPath* is a native representation of a geometric path. The contents are specific and private to the respective renderer. Instances are reference counted and can therefore be assigned as usual. The only way to get a valid instance is by using *wxGraphicsContext:createPath/1* or *wxGraphicsRenderer:createPath/1*.

This class is derived (and can use functions) from: *wxGraphicsObject*

wxWidgets docs: wxGraphicsPath

## DATA TYPES

```
wxGraphicsPath() = wx:wx_object()
```

## EXPORTS

```
moveToPoint(This, P) -> ok
```

Types:

This = wxGraphicsPath()\
 P = {X :: float(), Y :: float()}\

Begins a new subpath at *p*.

```
moveToPoint(This, X, Y) -> ok
```

Types:

This = wxGraphicsPath()\
 X = Y = number()\

Begins a new subpath at (*x*,*y*).

```
addArc(This, C, R, StartAngle, EndAngle, Clockwise) -> ok
```

Types:

This = wxGraphicsPath()\
 C = {X :: float(), Y :: float()}\
 R = StartAngle = EndAngle = number()\
 Clockwise = boolean()\

```
addArc(This, X, Y, R, StartAngle, EndAngle, Clockwise) -> ok
```

Types:

This = wxGraphicsPath()\
 X = Y = R = StartAngle = EndAngle = number()\
 Clockwise = boolean()\

Adds an arc of a circle.

The circle is defined by the coordinates of its centre (*x*, *y*) or *c* and its radius *r*. The arc goes from the starting angle *startAngle* to *endAngle* either clockwise or counter-clockwise depending on the value of *clockwise* argument.

The angles are measured in radians but, contrary to the usual mathematical convention, are always *clockwise* from the horizontal axis.

If for clockwise arc *endAngle* is less than *startAngle* it will be progressively increased by 2\*pi until it is greater than *startAngle*. If for counter-clockwise arc *endAngle* is greater than *startAngle* it will be progressively decreased by 2\*pi until it is less than *startAngle*.

If there is a current point set, an initial line segment will be added to the path to connect the current point to the beginning of the arc.

```
addArcToPoint(This, X1, Y1, X2, Y2, R) -> ok
```

Types:

This = wxGraphicsPath()\
 X1 = Y1 = X2 = Y2 = R = number()\

Adds an arc (of a circle with radius *r*) that is tangent to the line connecting current point and (*x1*, *y1*) and to the line connecting (*x1*, *y1*) and (*x2*, *y2*).

If the current point and the starting point of the arc are different, a straight line connecting these points is also appended. If there is no current point before the call to *addArcToPoint/6* this function will behave as if preceded by a call to MoveToPoint(0, 0). After this call the current point will be at the ending point of the arc.

```
addCircle(This, X, Y, R) -> ok
```

Types:

This = wxGraphicsPath()\
 X = Y = R = number()\

Appends a circle around (*x*,*y*) with radius *r* as a new closed subpath.

After this call the current point will be at (x+*r*, *y*).

```
addCurveToPoint(This, C1, C2, E) -> ok
```

Types:

This = wxGraphicsPath()\
 C1 = C2 = E = {X :: float(), Y :: float()}\

Adds a cubic bezier curve from the current point, using two control points and an end point.

If there is no current point before the call to *addCurveToPoint/7* this function will behave as if preceded by a call to MoveToPoint(*c1*).

```
addCurveToPoint(This, Cx1, Cy1, Cx2, Cy2, X, Y) -> ok
```

Types:

This = wxGraphicsPath()\
 Cx1 = Cy1 = Cx2 = Cy2 = X = Y = number()\

Adds a cubic bezier curve from the current point, using two control points and an end point.

If there is no current point before the call to *addCurveToPoint/7* this function will behave as if preceded by a call to MoveToPoint(*cx1*, *cy1*).

```
addEllipse(This, X, Y, W, H) -> ok
```

Types:

This = wxGraphicsPath()\
 X = Y = W = H = number()\

Appends an ellipse fitting into the passed in rectangle as a new closed subpath.

After this call the current point will be at (x+*w*, y+*h/2*).

```
addLineToPoint(This, P) -> ok
```

Types:

This = wxGraphicsPath()\
 P = {X :: float(), Y :: float()}\

Adds a straight line from the current point to *p*.

If current point is not yet set before the call to *addLineToPoint/3* this function will behave as *moveToPoint/3*.

```
addLineToPoint(This, X, Y) -> ok
```

Types:

This = wxGraphicsPath()\
 X = Y = number()\

Adds a straight line from the current point to (*x*,*y*).

If current point is not yet set before the call to *addLineToPoint/3* this function will behave as *moveToPoint/3*.

```
addPath(This, Path) -> ok
```

Types:

This = Path = wxGraphicsPath()\

Adds another path onto the current path.

After this call the current point will be at the added path's current point. For Direct2D the path being appended shouldn't contain a started non-empty subpath when this function is called.

```
addQuadCurveToPoint(This, Cx, Cy, X, Y) -> ok
```

Types:

This = wxGraphicsPath()\
 Cx = Cy = X = Y = number()\

Adds a quadratic bezier curve from the current point, using a control point and an end point.

If there is no current point before the call to *addQuadCurveToPoint/5* this function will behave as if preceded by a call to MoveToPoint(*cx*, *cy*).

```
addRectangle(This, X, Y, W, H) -> ok
```

Types:

This = wxGraphicsPath()\
 X = Y = W = H = number()\

Appends a rectangle as a new closed subpath.

After this call the current point will be at (*x*, *y*).

```
addRoundedRectangle(This, X, Y, W, H, Radius) -> ok
```

Types:

This = wxGraphicsPath()\
 X = Y = W = H = Radius = number()\

Appends a rounded rectangle as a new closed subpath.

If *radius* equals 0 this function will behave as *addRectangle/5*, otherwise after this call the current point will be at (x+*w*, y+*h/2*).

```
closeSubpath(This) -> ok
```

Types:

This = wxGraphicsPath()\

Closes the current sub-path.

After this call the current point will be at the joined endpoint of the sub-path.

```
contains(This, C) -> boolean()
```

Types:

This = wxGraphicsPath()\
 C = {X :: float(), Y :: float()}\

```
contains(This, X, Y) -> boolean()
```

```
contains(This, C, Y :: [Option]) -> boolean()
```

Types:

This = wxGraphicsPath()\
 C = {X :: float(), Y :: float()}\
 Option = {fillStyle, wx:wx\_enum()}\

Return: true if the point is within the path.

```
contains(This, X, Y, Options :: [Option]) -> boolean()
```

Types:

This = wxGraphicsPath()\
 X = Y = number()\
 Option = {fillStyle, wx:wx\_enum()}\

Return: true if the point is within the path.

```
getBox(This) ->
          {X :: float(), Y :: float(), W :: float(), H :: float()}
```

Types:

This = wxGraphicsPath()\

Gets the bounding box enclosing all points (possibly including control points).

```
getCurrentPoint(This) -> {X :: float(), Y :: float()}
```

Types:

This = wxGraphicsPath()\

Gets the last point of the current path, (0,0) if not yet set.

```
transform(This, Matrix) -> ok
```

Types:

This = wxGraphicsPath()\
 Matrix = wxGraphicsMatrix:wxGraphicsMatrix()\

Transforms each point of this path by the matrix.

For Direct2D the current path shouldn't contain a started non-empty subpath when this function is called.
