Version: 3.2.6

#include <wx/graphics.h>

+ Inheritance diagram for wxGraphicsPath:

Detailed 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() 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)
 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). More...
 
virtual void AddCircle (wxDouble x, wxDouble y, wxDouble r)
 Appends a circle around (x,y) with radius r as a new closed subpath. More...
 
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. More...
 
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. More...
 
virtual void AddEllipse (wxDouble x, wxDouble y, wxDouble w, wxDouble h)
 Appends an ellipse fitting into the passed in rectangle as a new closed subpath. More...
 
virtual void AddLineToPoint (wxDouble x, wxDouble y)
 Adds a straight line from the current point to (x,y). More...
 
void AddLineToPoint (const wxPoint2DDouble &p)
 Adds a straight line from the current point to p. More...
 
virtual void AddPath (const wxGraphicsPath &path)
 Adds another path onto the current path. More...
 
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. More...
 
virtual void AddRectangle (wxDouble x, wxDouble y, wxDouble w, wxDouble h)
 Appends a rectangle as a new closed subpath. More...
 
virtual void AddRoundedRectangle (wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius)
 Appends a rounded rectangle as a new closed subpath. More...
 
virtual void CloseSubpath ()
 Closes the current sub-path. More...
 
bool Contains (const wxPoint2DDouble &c, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) const
 
virtual bool Contains (wxDouble x, wxDouble y, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) const
 
wxRect2DDouble GetBox () const
 Gets the bounding box enclosing all points (possibly including control points). More...
 
virtual void GetBox (wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const
 Gets the bounding box enclosing all points (possibly including control points). More...
 
virtual void GetCurrentPoint (wxDouble *x, wxDouble *y) const
 Gets the last point of the current path, (0,0) if not yet set. More...
 
wxPoint2DDouble GetCurrentPoint () const
 Gets the last point of the current path, (0,0) if not yet set. More...
 
virtual void * GetNativePath () const
 Returns the native path (CGPathRef for Core Graphics, Path pointer for GDIPlus and a cairo_path_t pointer for cairo). More...
 
virtual void MoveToPoint (wxDouble x, wxDouble y)
 Begins a new subpath at (x,y). More...
 
void MoveToPoint (const wxPoint2DDouble &p)
 Begins a new subpath at p. More...
 
virtual void Transform (const wxGraphicsMatrix &matrix)
 Transforms each point of this path by the matrix. More...
 
virtual void UnGetNativePath (void *p) const
 Gives back the native path returned by GetNativePath() because there might be some deallocations necessary (e.g. More...
 
virtual void AddArc (wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise)
 Adds an arc of a circle. More...
 
void AddArc (const wxPoint2DDouble &c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise)
 Adds an arc of a circle. More...
 
- Public Member Functions inherited from wxGraphicsObject
wxGraphicsRendererGetRenderer () const
 Returns the renderer that was used to create this instance, or NULL if it has not been initialized yet. More...
 
bool IsNull () const
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data. More...
 
 wxObject (const wxObject &other)
 Copy ctor. More...
 
virtual ~wxObject ()
 Destructor. More...
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class. More...
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj. More...
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone. More...
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer. More...
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public. More...
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 
void * operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object. More...
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Member Function Documentation

◆ AddArc() [1/2]

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.

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.

◆ AddArc() [2/2]

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.

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

virtual void wxGraphicsPath::AddArcToPoint ( wxDouble  x1,
wxDouble  y1,
wxDouble  x2,
wxDouble  y2,
wxDouble  r 
)
virtual

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

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.

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

◆ AddCurveToPoint() [1/2]

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.

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

◆ AddCurveToPoint() [2/2]

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.

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

◆ AddEllipse()

virtual void wxGraphicsPath::AddEllipse ( wxDouble  x,
wxDouble  y,
wxDouble  w,
wxDouble  h 
)
virtual

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() [1/2]

void wxGraphicsPath::AddLineToPoint ( const wxPoint2DDouble p)

Adds a straight line from the current point to p.

If current point is not yet set before the call to AddLineToPoint() this function will behave as MoveToPoint().

◆ AddLineToPoint() [2/2]

virtual void wxGraphicsPath::AddLineToPoint ( wxDouble  x,
wxDouble  y 
)
virtual

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

If current point is not yet set before the call to AddLineToPoint() this function will behave as MoveToPoint().

◆ AddPath()

virtual void wxGraphicsPath::AddPath ( const wxGraphicsPath path)
virtual

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

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.

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

◆ AddRectangle()

virtual void wxGraphicsPath::AddRectangle ( wxDouble  x,
wxDouble  y,
wxDouble  w,
wxDouble  h 
)
virtual

Appends a rectangle as a new closed subpath.

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

◆ AddRoundedRectangle()

virtual void wxGraphicsPath::AddRoundedRectangle ( wxDouble  x,
wxDouble  y,
wxDouble  w,
wxDouble  h,
wxDouble  radius 
)
virtual

Appends a rounded rectangle as a new closed subpath.

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

◆ CloseSubpath()

virtual void wxGraphicsPath::CloseSubpath ( )
virtual

Closes the current sub-path.

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

◆ Contains() [1/2]

bool wxGraphicsPath::Contains ( const wxPoint2DDouble c,
wxPolygonFillMode  fillStyle = wxODDEVEN_RULE 
) const
Returns
true if the point is within the path.

◆ Contains() [2/2]

virtual bool wxGraphicsPath::Contains ( wxDouble  x,
wxDouble  y,
wxPolygonFillMode  fillStyle = wxODDEVEN_RULE 
) const
virtual
Returns
true if the point is within the path.

◆ GetBox() [1/2]

wxRect2DDouble wxGraphicsPath::GetBox ( ) const

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

◆ GetBox() [2/2]

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

◆ GetCurrentPoint() [1/2]

wxPoint2DDouble wxGraphicsPath::GetCurrentPoint ( ) const

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

◆ GetCurrentPoint() [2/2]

virtual void wxGraphicsPath::GetCurrentPoint ( wxDouble x,
wxDouble y 
) const
virtual

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

◆ GetNativePath()

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

◆ MoveToPoint() [1/2]

void wxGraphicsPath::MoveToPoint ( const wxPoint2DDouble p)

Begins a new subpath at p.

◆ MoveToPoint() [2/2]

virtual void wxGraphicsPath::MoveToPoint ( wxDouble  x,
wxDouble  y 
)
virtual

Begins a new subpath at (x,y).

◆ Transform()

virtual void wxGraphicsPath::Transform ( const wxGraphicsMatrix matrix)
virtual

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.

◆ UnGetNativePath()

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