.. include:: headings.inc .. _GraphicsPath: ========================================================================================================================================== |phoenix_title| **GraphicsPath** ========================================================================================================================================== A :ref:`GraphicsPath` 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 :meth:`GraphicsContext.CreatePath` or :meth:`GraphicsRenderer.CreatePath` . | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **GraphicsPath** .. raw:: html

Inheritance diagram of GraphicsPath

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~GraphicsPath.AddArc` Adds an arc of a circle. :meth:`~GraphicsPath.AddArcToPoint` 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`). :meth:`~GraphicsPath.AddCircle` Appends a circle around (`x`,`y`) with radius `r` as a new closed subpath. :meth:`~GraphicsPath.AddCurveToPoint` Adds a cubic bezier curve from the current point, using two control points and an end point. :meth:`~GraphicsPath.AddEllipse` Appends an ellipse fitting into the passed in rectangle. :meth:`~GraphicsPath.AddLineToPoint` Adds a straight line from the current point to (`x`,`y`). :meth:`~GraphicsPath.AddPath` Adds another path. :meth:`~GraphicsPath.AddQuadCurveToPoint` Adds a quadratic bezier curve from the current point, using a control point and an end point. :meth:`~GraphicsPath.AddRectangle` Appends a rectangle as a new closed subpath. :meth:`~GraphicsPath.AddRoundedRectangle` Appends a rounded rectangle as a new closed subpath. :meth:`~GraphicsPath.CloseSubpath` Closes the current sub-path. :meth:`~GraphicsPath.Contains` :meth:`~GraphicsPath.GetBox` Gets the bounding box enclosing all points (possibly including control points). :meth:`~GraphicsPath.GetCurrentPoint` Gets the last point of the current path, (0,0) if not yet set. :meth:`~GraphicsPath.GetNativePath` Returns the native path (CGPathRef for Core Graphics, Path pointer for GDIPlus and a cairo_path_t pointer for cairo). :meth:`~GraphicsPath.MoveToPoint` Begins a new subpath at (`x`,`y`). :meth:`~GraphicsPath.Transform` Transforms each point of this path by the matrix. :meth:`~GraphicsPath.UnGetNativePath` Gives back the native path returned by :meth:`GetNativePath` because there might be some deallocations necessary (e.g. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~GraphicsPath.Box` See :meth:`~GraphicsPath.GetBox` :attr:`~GraphicsPath.CurrentPoint` See :meth:`~GraphicsPath.GetCurrentPoint` :attr:`~GraphicsPath.NativePath` See :meth:`~GraphicsPath.GetNativePath` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: 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. |overload| **Overloaded Implementations**: **~~~** **AddArc** `(self, x, y, r, startAngle, endAngle, clockwise)` :param `x`: :type `x`: float :param `y`: :type `y`: float :param `r`: :type `r`: float :param `startAngle`: :type `startAngle`: float :param `endAngle`: :type `endAngle`: float :param `clockwise`: :type `clockwise`: bool **~~~** **AddArc** `(self, c, r, startAngle, endAngle, clockwise)` :param `c`: :type `c`: Point2D :param `r`: :type `r`: float :param `startAngle`: :type `startAngle`: float :param `endAngle`: :type `endAngle`: float :param `clockwise`: :type `clockwise`: bool **~~~** .. method:: AddArcToPoint(self, x1, y1, x2, y2, 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`). :param `x1`: :type `x1`: float :param `y1`: :type `y1`: float :param `x2`: :type `x2`: float :param `y2`: :type `y2`: float :param `r`: :type `r`: float .. method:: AddCircle(self, x, y, r) Appends a circle around (`x`,`y`) with radius `r` as a new closed subpath. :param `x`: :type `x`: float :param `y`: :type `y`: float :param `r`: :type `r`: float .. method:: AddCurveToPoint(self, *args, **kw) Adds a cubic bezier curve from the current point, using two control points and an end point. |overload| **Overloaded Implementations**: **~~~** **AddCurveToPoint** `(self, cx1, cy1, cx2, cy2, x, y)` :param `cx1`: :type `cx1`: float :param `cy1`: :type `cy1`: float :param `cx2`: :type `cx2`: float :param `cy2`: :type `cy2`: float :param `x`: :type `x`: float :param `y`: :type `y`: float **~~~** **AddCurveToPoint** `(self, c1, c2, e)` :param `c1`: :type `c1`: Point2D :param `c2`: :type `c2`: Point2D :param `e`: :type `e`: Point2D **~~~** .. method:: AddEllipse(self, x, y, w, h) Appends an ellipse fitting into the passed in rectangle. :param `x`: :type `x`: float :param `y`: :type `y`: float :param `w`: :type `w`: float :param `h`: :type `h`: float .. method:: AddLineToPoint(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **AddLineToPoint** `(self, x, y)` Adds a straight line from the current point to (`x`,`y`). :param `x`: :type `x`: float :param `y`: :type `y`: float **~~~** **AddLineToPoint** `(self, p)` Adds a straight line from the current point to `p`. :param `p`: :type `p`: Point2D **~~~** .. method:: AddPath(self, path) Adds another path. :param `path`: :type `path`: GraphicsPath .. method:: AddQuadCurveToPoint(self, cx, cy, x, y) Adds a quadratic bezier curve from the current point, using a control point and an end point. :param `cx`: :type `cx`: float :param `cy`: :type `cy`: float :param `x`: :type `x`: float :param `y`: :type `y`: float .. method:: AddRectangle(self, x, y, w, h) Appends a rectangle as a new closed subpath. :param `x`: :type `x`: float :param `y`: :type `y`: float :param `w`: :type `w`: float :param `h`: :type `h`: float .. method:: AddRoundedRectangle(self, x, y, w, h, radius) Appends a rounded rectangle as a new closed subpath. :param `x`: :type `x`: float :param `y`: :type `y`: float :param `w`: :type `w`: float :param `h`: :type `h`: float :param `radius`: :type `radius`: float .. method:: CloseSubpath(self) Closes the current sub-path. .. method:: Contains(self, *args, **kw) :returns: ``True`` if the point is within the path. |overload| **Overloaded Implementations**: **~~~** **Contains** `(self, c, fillStyle=ODDEVEN_RULE)` :param `c`: :type `c`: Point2D :param `fillStyle`: :type `fillStyle`: PolygonFillMode :rtype: `bool` **~~~** **Contains** `(self, x, y, fillStyle=ODDEVEN_RULE)` :param `x`: :type `x`: float :param `y`: :type `y`: float :param `fillStyle`: :type `fillStyle`: PolygonFillMode :rtype: `bool` **~~~** .. method:: GetBox(self, *args, **kw) Gets the bounding box enclosing all points (possibly including control points). .. method:: GetCurrentPoint(self, *args, **kw) Gets the last point of the current path, (0,0) if not yet set. .. method:: GetNativePath(self) Returns the native path (CGPathRef for Core Graphics, Path pointer for GDIPlus and a cairo_path_t pointer for cairo). .. method:: MoveToPoint(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **MoveToPoint** `(self, x, y)` Begins a new subpath at (`x`,`y`). :param `x`: :type `x`: float :param `y`: :type `y`: float **~~~** **MoveToPoint** `(self, p)` Begins a new subpath at `p`. :param `p`: :type `p`: Point2D **~~~** .. method:: Transform(self, matrix) Transforms each point of this path by the matrix. :param `matrix`: :type `matrix`: GraphicsMatrix .. method:: UnGetNativePath(self, p) 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`: .. attribute:: Box See :meth:`~GraphicsPath.GetBox` .. attribute:: CurrentPoint See :meth:`~GraphicsPath.GetCurrentPoint` .. attribute:: NativePath See :meth:`~GraphicsPath.GetNativePath`