.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.GraphicsPath:

==========================================================================================================================================
|phoenix_title|  **wx.GraphicsPath**
==========================================================================================================================================

A :ref:`wx.GraphicsPath`  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 :meth:`wx.GraphicsContext.CreatePath`   or :meth:`wx.GraphicsRenderer.CreatePath` . 









|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>GraphicsPath</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.GraphicsPath_inheritance.svg" alt="Inheritance diagram of GraphicsPath" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.GraphicsPath.html" title="A wx.GraphicsPath  is a native representation of a geometric path." alt="" coords="12,159,162,188"/> <area shape="rect" id="node2" href="wx.GraphicsObject.html" title="This class is the superclass of native graphics objects like pens etc." alt="" coords="5,82,168,111"/> <area shape="rect" id="node3" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="37,5,136,34"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.GraphicsPath.AddArc`                                                  Adds an arc of a circle.
:meth:`~wx.GraphicsPath.AddArcToPoint`                                           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`).
:meth:`~wx.GraphicsPath.AddCircle`                                               Appends a circle around (`x`,`y`) with radius `r`  as a new closed subpath.
:meth:`~wx.GraphicsPath.AddCurveToPoint`                                         Adds a cubic bezier curve from the current point, using two control points and an end point.
:meth:`~wx.GraphicsPath.AddEllipse`                                              Appends an ellipse fitting into the passed in rectangle as a new closed subpath.
:meth:`~wx.GraphicsPath.AddLineToPoint`                                          Adds a straight line from the current point to (`x`,`y`).
:meth:`~wx.GraphicsPath.AddPath`                                                 Adds another path onto the current path.
:meth:`~wx.GraphicsPath.AddQuadCurveToPoint`                                     Adds a quadratic bezier curve from the current point, using a control point and an end point.
:meth:`~wx.GraphicsPath.AddRectangle`                                            Appends a rectangle as a new closed subpath.
:meth:`~wx.GraphicsPath.AddRoundedRectangle`                                     Appends a rounded rectangle as a new closed subpath.
:meth:`~wx.GraphicsPath.CloseSubpath`                                            Closes the current sub-path.
:meth:`~wx.GraphicsPath.Contains`                                                
:meth:`~wx.GraphicsPath.GetBox`                                                  Gets the bounding box enclosing all points (possibly including control points).
:meth:`~wx.GraphicsPath.GetCurrentPoint`                                         Gets the last point of the current path, (0,0) if not yet set.
:meth:`~wx.GraphicsPath.GetNativePath`                                           Returns the native path (CGPathRef for Core Graphics, Path pointer for GDIPlus and a cairo_path_t pointer for cairo).
:meth:`~wx.GraphicsPath.MoveToPoint`                                             Begins a new subpath at (`x`,`y`).
:meth:`~wx.GraphicsPath.Transform`                                               Transforms each point of this path by the matrix.
:meth:`~wx.GraphicsPath.UnGetNativePath`                                         Gives back the native path returned by :meth:`~GraphicsPath.GetNativePath`   because there might be some deallocations necessary (e.g.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.GraphicsPath.Box`                                                     See :meth:`~wx.GraphicsPath.GetBox`
:attr:`~wx.GraphicsPath.CurrentPoint`                                            See :meth:`~wx.GraphicsPath.GetCurrentPoint`
:attr:`~wx.GraphicsPath.NativePath`                                              See :meth:`~wx.GraphicsPath.GetNativePath`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.GraphicsPath(GraphicsObject)

   A GraphicsPath is a native representation of a geometric path.



   .. method:: AddArc(self, *args, **kw)

      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 2pi until it is greater than `startAngle`. If for counter-clockwise arc `endAngle`  is greater than `startAngle`  it will be progressively decreased by 2pi 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. 
                  


      |overload| **Overloaded Implementations:**

      :html:`<hr class="overloadsep" /><br />`

      
      **AddArc** `(self, x : float, y : float, r : float, startAngle : float, endAngle : float, clockwise : bool)`
      
      
      
      
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `r`: 
      :type `r`: wx.Double
      :param `startAngle`: 
      :type `startAngle`: wx.Double
      :param `endAngle`: 
      :type `endAngle`: wx.Double
      :param `clockwise`: 
      :type `clockwise`: bool
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **AddArc** `(self, c : Point2D, r : float, startAngle : float, endAngle : float, clockwise : bool)`
      
      
      
      
      :param `c`: 
      :type `c`: wx.Point2D
      :param `r`: 
      :type `r`: wx.Double
      :param `startAngle`: 
      :type `startAngle`: wx.Double
      :param `endAngle`: 
      :type `endAngle`: wx.Double
      :param `clockwise`: 
      :type `clockwise`: bool
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: AddArcToPoint(self, x1 : float, y1 : float, x2 : float, y2 : float, r : float)

      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 :meth:`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. 

      .. figure:: _static/images/overviews/drawing-addarctopoint.png
         :align: center


      |


                 


      :param `x1`: 
      :type `x1`: wx.Double
      :param `y1`: 
      :type `y1`: wx.Double
      :param `x2`: 
      :type `x2`: wx.Double
      :param `y2`: 
      :type `y2`: wx.Double
      :param `r`: 
      :type `r`: wx.Double




      :rtype: `None`     








   .. method:: AddCircle(self, x : float, y : float, r : float)

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


      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `r`: 
      :type `r`: wx.Double




      :rtype: `None`     








   .. method:: AddCurveToPoint(self, *args, **kw)



      |overload| **Overloaded Implementations:**

      :html:`<hr class="overloadsep" /><br />`

      
      **AddCurveToPoint** `(self, cx1 : float, cy1 : float, cx2 : float, cy2 : float, 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 :meth:`AddCurveToPoint`   this function will behave as if preceded by a call to MoveToPoint(`cx1`, `cy1`). 
                       
      
      
      :param `cx1`: 
      :type `cx1`: wx.Double
      :param `cy1`: 
      :type `cy1`: wx.Double
      :param `cx2`: 
      :type `cx2`: wx.Double
      :param `cy2`: 
      :type `cy2`: wx.Double
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **AddCurveToPoint** `(self, c1 : Point2D, c2 : Point2D, e : Point2D)`
      
      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 :meth:`AddCurveToPoint`   this function will behave as if preceded by a call to MoveToPoint(`c1`). 
                       
      
      
      :param `c1`: 
      :type `c1`: wx.Point2D
      :param `c2`: 
      :type `c2`: wx.Point2D
      :param `e`: 
      :type `e`: wx.Point2D
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: AddEllipse(self, x : float, y : float, w : float, h : float)

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


      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double




      :rtype: `None`     








   .. method:: AddLineToPoint(self, *args, **kw)



      |overload| **Overloaded Implementations:**

      :html:`<hr class="overloadsep" /><br />`

      
      **AddLineToPoint** `(self, x : float, y : float)`
      
      Adds a straight line from the current point to (`x`,`y`). 
                       
      
      If current point is not yet set before the call to :meth:`AddLineToPoint`   this function will behave as :meth:`MoveToPoint` . 
                       
      
      
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **AddLineToPoint** `(self, p : Point2D)`
      
      Adds a straight line from the current point to `p`. 
                       
      
      If current point is not yet set before the call to :meth:`AddLineToPoint`   this function will behave as :meth:`MoveToPoint` . 
                       
      
      
      :param `p`: 
      :type `p`: wx.Point2D
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: AddPath(self, path : GraphicsPath)

      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. 
                 


      :param `path`: 
      :type `path`: wx.GraphicsPath




      :rtype: `None`     








   .. method:: AddQuadCurveToPoint(self, cx : float, cy : float, x : float, y : float)

      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 :meth:`AddQuadCurveToPoint`   this function will behave as if preceded by a call to MoveToPoint(`cx`, `cy`). 
                 


      :param `cx`: 
      :type `cx`: wx.Double
      :param `cy`: 
      :type `cy`: wx.Double
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double




      :rtype: `None`     








   .. method:: AddRectangle(self, x : float, y : float, w : float, h : float)

      Appends a rectangle as a new closed subpath. 
                 

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


      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double




      :rtype: `None`     








   .. method:: AddRoundedRectangle(self, x : float, y : float, w : float, h : float, radius : float)

      Appends a rounded rectangle as a new closed subpath. 
                 

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


      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double
      :param `radius`: 
      :type `radius`: wx.Double




      :rtype: `None`     








   .. method:: CloseSubpath(self)

      Closes the current sub-path. 
                 

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

      :rtype: `None`     








   .. method:: Contains(self, *args, **kw)




                



      :returns: 

         ``True`` if the point is within the path.   





      |overload| **Overloaded Implementations:**

      :html:`<hr class="overloadsep" /><br />`

      
      **Contains** `(self, c : Point2D, fillStyle: PolygonFillMode=ODDEVEN_RULE)`
      
      
      
      
      :param `c`: 
      :type `c`: wx.Point2D
      :param `fillStyle`: 
      :type `fillStyle`: wx.PolygonFillMode
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **Contains** `(self, x : float, y : float, fillStyle: PolygonFillMode=ODDEVEN_RULE)`
      
      
      
      
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `fillStyle`: 
      :type `fillStyle`: wx.PolygonFillMode
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: GetBox(self)

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

      :rtype: :ref:`wx.Rect2D`








   .. method:: GetCurrentPoint(self)

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

      :rtype: :ref:`wx.Point2D`








   .. method:: GetNativePath(self)

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

      :rtype: `Any`     








   .. method:: MoveToPoint(self, *args, **kw)



      |overload| **Overloaded Implementations:**

      :html:`<hr class="overloadsep" /><br />`

      
      **MoveToPoint** `(self, x : float, y : float)`
      
      Begins a new subpath at (`x`,`y`). 
                       
      
      
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **MoveToPoint** `(self, p : Point2D)`
      
      Begins a new subpath at `p`. 
                       
      
      
      :param `p`: 
      :type `p`: wx.Point2D
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: Transform(self, matrix : GraphicsMatrix)

      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. 
                 


      :param `matrix`: 
      :type `matrix`: wx.GraphicsMatrix




      :rtype: `None`     








   .. method:: UnGetNativePath(self, p : Any)

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

      on cairo the native path returned by :meth:`GetNativePath`   is newly allocated each time). 
                 


      :param `p`: 




      :rtype: `None`     








   .. attribute:: Box

      See :meth:`~wx.GraphicsPath.GetBox`


   .. attribute:: CurrentPoint

      See :meth:`~wx.GraphicsPath.GetCurrentPoint`


   .. attribute:: NativePath

      See :meth:`~wx.GraphicsPath.GetNativePath`