# wxGraphicsPath Class Reference
[Graphics Device Interface (GDI)]

`#include <wx/graphics.h>`

Inheritance diagram for wxGraphicsPath:
[legend]

## Detailed Description

A wxGraphicsPath is a native representation of a geometric path.

The contents are specific an 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() or wxGraphicsRenderer::CreatePath().

##

Library: wxCore

Category: Graphics Device Interface (GDI)

## Public Member Functions
virtual void | AddArcToPoint (wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, wxDouble r)
| Appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1).
virtual void | AddCircle (wxDouble x, wxDouble y, wxDouble r)
| Appends a circle around (x,y) with radius r as a new closed subpath.
virtual void | AddCurveToPoint (wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y)
| Adds a cubic bezier curve from the current point, using two control points and an end point.
void | AddCurveToPoint (const wxPoint2DDouble &c1, const wxPoint2DDouble &c2, const wxPoint2DDouble &e)
| Adds a cubic bezier curve from the current point, using two control points and an end point.
virtual void | AddEllipse (wxDouble x, wxDouble y, wxDouble w, wxDouble h)
| Appends an ellipse fitting into the passed in rectangle.
virtual void | AddLineToPoint (wxDouble x, wxDouble y)
| Adds a straight line from the current point to (x,y).
void | AddLineToPoint (const wxPoint2DDouble &p)
| Adds a straight line from the current point to p.
virtual void | AddPath (const wxGraphicsPath &path)
| Adds another path.
virtual void | AddQuadCurveToPoint (wxDouble cx, wxDouble cy, wxDouble x, wxDouble y)
| Adds a quadratic bezier curve from the current point, using a control point and an end point.
virtual void | AddRectangle (wxDouble x, wxDouble y, wxDouble w, wxDouble h)
| Appends a rectangle as a new closed subpath.
virtual void | AddRoundedRectangle (wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius)
| Appends a rounded rectangle as a new closed subpath.
virtual void | CloseSubpath ()
| Closes the current sub-path.
bool | Contains (const wxPoint2DDouble &c, int fillStyle=wxODDEVEN_RULE) const
virtual bool | Contains (wxDouble x, wxDouble y, int fillStyle=wxODDEVEN_RULE) const
wxRect2DDouble | GetBox () const
| Gets the bounding box enclosing all points (possibly including control points).
virtual void | GetBox (wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const
| Gets the bounding box enclosing all points (possibly including control points).
virtual void | GetCurrentPoint (wxDouble *x, wxDouble *y) const
| Gets the last point of the current path, (0,0) if not yet set.
wxPoint2DDouble | GetCurrentPoint () const
| Gets the last point of the current path, (0,0) if not yet set.
virtual void * | GetNativePath () const
| Returns the native path (CGPathRef for Core Graphics, Path pointer for GDIPlus and a cairo_path_t pointer for cairo).
virtual void | MoveToPoint (wxDouble x, wxDouble y)
| Begins a new subpath at (x,y).
void | MoveToPoint (const wxPoint2DDouble &p)
| Begins a new subpath at p.
virtual void | Transform (const wxGraphicsMatrix &matrix)
| Transforms each point of this path by the matrix.
virtual void | UnGetNativePath (void *p) const
| Gives back the native path returned by GetNativePath() because there might be some deallocations necessary (e.g.
virtual void | AddArc (wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise)
| Adds an arc of a circle.
void | AddArc (const wxPoint2DDouble &c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise)
| Adds an arc of a circle.

List of all members.

## Member Function Documentation

void wxGraphicsPath::AddArc | ( | const wxPoint2DDouble & | c,
|  | wxDouble | r,
|  | wxDouble | startAngle,
|  | wxDouble | endAngle,
|  | bool | clockwise |
| ) |  |  |

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.

virtual void wxGraphicsPath::AddArc | ( | wxDouble | x,
|  | wxDouble | y,
|  | wxDouble | r,
|  | wxDouble | startAngle,
|  | wxDouble | endAngle,
|  | bool | clockwise |
| ) |  |  | `[virtual]`

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.

virtual void wxGraphicsPath::AddArcToPoint | ( | wxDouble | x1,
|  | wxDouble | y1,
|  | wxDouble | x2,
|  | wxDouble | y2,
|  | wxDouble | r |
| ) |  |  | `[virtual]`

Appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1).

virtual void wxGraphicsPath::AddCircle | ( | wxDouble | x,
|  | wxDouble | y,
|  | wxDouble | r |
| ) |  |  | `[virtual]`

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

void wxGraphicsPath::AddCurveToPoint | ( | const wxPoint2DDouble & | c1,
|  | const wxPoint2DDouble & | c2,
|  | const wxPoint2DDouble & | e |
| ) |  |  |

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

virtual void wxGraphicsPath::AddCurveToPoint | ( | wxDouble | cx1,
|  | wxDouble | cy1,
|  | wxDouble | cx2,
|  | wxDouble | cy2,
|  | wxDouble | x,
|  | wxDouble | y |
| ) |  |  | `[virtual]`

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

virtual void wxGraphicsPath::AddEllipse | ( | wxDouble | x,
|  | wxDouble | y,
|  | wxDouble | w,
|  | wxDouble | h |
| ) |  |  | `[virtual]`

Appends an ellipse fitting into the passed in rectangle.

void wxGraphicsPath::AddLineToPoint | ( | const wxPoint2DDouble & | p | ) |

Adds a straight line from the current point to p.

virtual void wxGraphicsPath::AddLineToPoint | ( | wxDouble | x,
|  | wxDouble | y |
| ) |  |  | `[virtual]`

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

virtual void wxGraphicsPath::AddPath | ( | const wxGraphicsPath & | path | ) | `[virtual]`

Adds another path.

virtual void wxGraphicsPath::AddQuadCurveToPoint | ( | wxDouble | cx,
|  | wxDouble | cy,
|  | wxDouble | x,
|  | wxDouble | y |
| ) |  |  | `[virtual]`

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

virtual void wxGraphicsPath::AddRectangle | ( | wxDouble | x,
|  | wxDouble | y,
|  | wxDouble | w,
|  | wxDouble | h |
| ) |  |  | `[virtual]`

Appends a rectangle as a new closed subpath.

virtual void wxGraphicsPath::AddRoundedRectangle | ( | wxDouble | x,
|  | wxDouble | y,
|  | wxDouble | w,
|  | wxDouble | h,
|  | wxDouble | radius |
| ) |  |  | `[virtual]`

Appends a rounded rectangle as a new closed subpath.

virtual void wxGraphicsPath::CloseSubpath | ( |  | ) | `[virtual]`

Closes the current sub-path.

virtual bool wxGraphicsPath::Contains | ( | wxDouble | x,
|  | wxDouble | y,
|  | int | fillStyle = `wxODDEVEN_RULE` |
| ) |  |  | const`[virtual]`

Returns:
  true if the point is within the path.

bool wxGraphicsPath::Contains | ( | const wxPoint2DDouble & | c,
|  | int | fillStyle = `wxODDEVEN_RULE` |
| ) |  |  | const

Returns:
  true if the point is within the path.

virtual void wxGraphicsPath::GetBox | ( | wxDouble * | x,
|  | wxDouble * | y,
|  | wxDouble * | w,
|  | wxDouble * | h |
| ) |  |  | const`[virtual]`

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

wxRect2DDouble wxGraphicsPath::GetBox | ( |  | ) | const

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

wxPoint2DDouble wxGraphicsPath::GetCurrentPoint | ( |  | ) | const

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

virtual void wxGraphicsPath::GetCurrentPoint | ( | wxDouble * | x,
|  | wxDouble * | y |
| ) |  |  | const`[virtual]`

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

virtual void* wxGraphicsPath::GetNativePath | ( |  | ) | const`[virtual]`

Returns the native path (CGPathRef for Core Graphics, Path pointer for GDIPlus and a cairo_path_t pointer for cairo).

void wxGraphicsPath::MoveToPoint | ( | const wxPoint2DDouble & | p | ) |

Begins a new subpath at p.

virtual void wxGraphicsPath::MoveToPoint | ( | wxDouble | x,
|  | wxDouble | y |
| ) |  |  | `[virtual]`

Begins a new subpath at (x,y).

virtual void wxGraphicsPath::Transform | ( | const wxGraphicsMatrix & | matrix | ) | `[virtual]`

Transforms each point of this path by the matrix.

virtual void wxGraphicsPath::UnGetNativePath | ( | void * | p | ) | const`[virtual]`

Gives back the native path returned by GetNativePath() because there might be some deallocations necessary (e.g.

on cairo the native path returned by GetNativePath() is newly allocated each time).

|  | [ top ]