## wxGraphicsPath

A wxGraphicsPath is a native representation of an geometric path. The contents are specific an private to the respective renderer. Instances are ref counted and can therefore be assigned as usual. The only way to get a valid instance is via a CreatePath call on the graphics context or the renderer instance.

Derived from

wxGraphicsObject

Include files

<wx/graphics.h>

Members

wxGraphicsPath::MoveToPoint
wxGraphicsPath::AddArc
wxGraphicsPath::AddArcToPoint
wxGraphicsPath::AddCircle
wxGraphicsPath::AddCurveToPoint
wxGraphicsPath::AddEllipse
wxGraphicsPath::AddLineToPoint
wxGraphicsPath::AddPath
wxGraphicsPath::AddQuadCurveToPoint
wxGraphicsPath::AddRectangle
wxGraphicsPath::AddRoundedRectangle
wxGraphicsPath::CloseSubpath
wxGraphicsPath::Contains
wxGraphicsPath::GetBox
wxGraphicsPath::GetCurrentPoint
wxGraphicsPath::Transform
wxGraphicsPath::GetNativePath
wxGraphicsPath::UnGetNativePath

### wxGraphicsPath::MoveToPoint

void MoveToPoint(wxDouble x, wxDouble y)

void MoveToPoint(const wxPoint2DDouble& p)

Begins a new subpath at (x,y)

### wxGraphicsPath::AddArc

void AddArc(wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise)

Adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle.

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

### wxGraphicsPath::AddArcToPoint

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).

### wxGraphicsPath::AddCircle

void AddCircle(wxDouble x, wxDouble y, wxDouble r)

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

### wxGraphicsPath::AddCurveToPoint

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)

### wxGraphicsPath::AddEllipse

void AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h)

Appends an ellipse fitting into the passed in rectangle.

### wxGraphicsPath::AddLineToPoint

void AddLineToPoint(wxDouble x, wxDouble y)

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

void AddLineToPoint(const wxPoint2DDouble& p)

### wxGraphicsPath::AddPath

void AddPath(const wxGraphicsPath& path)

Adds another path.

### wxGraphicsPath::AddQuadCurveToPoint

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.

### wxGraphicsPath::AddRectangle

void AddRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h)

Appends a rectangle as a new closed subpath.

### wxGraphicsPath::AddRoundedRectangle

void AddRoundedRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius)

Appends a rounded rectangle as a new closed subpath.

### wxGraphicsPath::CloseSubpath

void CloseSubpath()

Closes the current sub-path.

### wxGraphicsPath::Contains

bool Contains(const wxPoint2DDouble& c, int fillStyle = wxODDEVEN_RULE) const

bool Contains(wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE) const

Returns true if the point is within the path.

### wxGraphicsPath::GetBox

wxRect2DDouble GetBox() const

void GetBox(wxDouble* x, wxDouble* y, wxDouble* w, wxDouble* h) const

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

### wxGraphicsPath::GetCurrentPoint

void GetCurrentPoint(wxDouble* x, wxDouble* y) const

wxPoint2DDouble GetCurrentPoint() const

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

### wxGraphicsPath::Transform

void Transform(const wxGraphicsMatrix& matrix)

Transforms each point of this path by the matrix.

### wxGraphicsPath::GetNativePath

void * GetNativePath() const

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

### wxGraphicsPath::UnGetNativePath

void UnGetNativePath(void* p) const

Gives back the native path returned by GetNativePath() because there might be some deallocations necessary (eg on cairo the native path returned by GetNativePath is newly allocated each time).