Table Of Contents

Previous topic

GraphicsObject

Next topic

GraphicsPen

This Page

phoenix_title GraphicsPath

A 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 GraphicsContext.CreatePath or GraphicsRenderer.CreatePath .


class_hierarchy Inheritance Diagram

Inheritance diagram for class GraphicsPath

Inheritance diagram of GraphicsPath


method_summary Methods Summary

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

api Class API



class GraphicsPath(GraphicsObject)

A GraphicsPath is a native representation of a geometric path.


Methods



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)

Parameters:
  • x (float) –
  • y (float) –
  • r (float) –
  • startAngle (float) –
  • endAngle (float) –
  • clockwise (bool) –



AddArc (self, c, r, startAngle, endAngle, clockwise)

Parameters:
  • c (Point2D) –
  • r (float) –
  • startAngle (float) –
  • endAngle (float) –
  • clockwise (bool) –





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

Parameters:
  • x1 (float) –
  • y1 (float) –
  • x2 (float) –
  • y2 (float) –
  • r (float) –


AddCircle(self, x, y, r)

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

Parameters:
  • x (float) –
  • y (float) –
  • r (float) –


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)

Parameters:
  • cx1 (float) –
  • cy1 (float) –
  • cx2 (float) –
  • cy2 (float) –
  • x (float) –
  • y (float) –



AddCurveToPoint (self, c1, c2, e)

Parameters:
  • c1 (Point2D) –
  • c2 (Point2D) –
  • e (Point2D) –





AddEllipse(self, x, y, w, h)

Appends an ellipse fitting into the passed in rectangle.

Parameters:
  • x (float) –
  • y (float) –
  • w (float) –
  • h (float) –


AddLineToPoint(self, *args, **kw)

overload Overloaded Implementations:



AddLineToPoint (self, x, y)

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

Parameters:
  • x (float) –
  • y (float) –



AddLineToPoint (self, p)

Adds a straight line from the current point to p.

Parameters:p (Point2D) –





AddPath(self, path)

Adds another path.

Parameters:path (GraphicsPath) –


AddQuadCurveToPoint(self, cx, cy, x, y)

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

Parameters:
  • cx (float) –
  • cy (float) –
  • x (float) –
  • y (float) –


AddRectangle(self, x, y, w, h)

Appends a rectangle as a new closed subpath.

Parameters:
  • x (float) –
  • y (float) –
  • w (float) –
  • h (float) –


AddRoundedRectangle(self, x, y, w, h, radius)

Appends a rounded rectangle as a new closed subpath.

Parameters:
  • x (float) –
  • y (float) –
  • w (float) –
  • h (float) –
  • radius (float) –


CloseSubpath(self)

Closes the current sub-path.



Contains(self, *args, **kw)
Returns:True if the point is within the path.

overload Overloaded Implementations:



Contains (self, c, fillStyle=ODDEVEN_RULE)

Parameters:
Return type:

bool



Contains (self, x, y, fillStyle=ODDEVEN_RULE)

Parameters:
Return type:

bool





GetBox(self, *args, **kw)

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



GetCurrentPoint(self, *args, **kw)

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



GetNativePath(self)

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



MoveToPoint(self, *args, **kw)

overload Overloaded Implementations:



MoveToPoint (self, x, y)

Begins a new subpath at (x,`y`).

Parameters:
  • x (float) –
  • y (float) –



MoveToPoint (self, p)

Begins a new subpath at p.

Parameters:p (Point2D) –





Transform(self, matrix)

Transforms each point of this path by the matrix.

Parameters:matrix (GraphicsMatrix) –


UnGetNativePath(self, p)

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

Parameters:p

Properties



Box

See GetBox



CurrentPoint

See GetCurrentPoint



NativePath

See GetNativePath