Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtGui.QPainterPath Class Reference

The QPainterPath class provides a container for painting operations, enabling graphical shapes to be constructed and reused. More...

Inheritance diagram for QtGui.QPainterPath:
Collaboration diagram for QtGui.QPainterPath:

Classes

class  Element
 The QPainterPath::Element class specifies the position and type of a subpath. More...
 

Public Types

enum  ElementType { CurveToDataElement = 3, CurveToElement = 2, LineToElement = 1, MoveToElement = 0 }
  More...
 

Public Member Functions

override bool Equals (object o)
 
override int GetHashCode ()
 
 QPainterPath ()
 
 
 QPainterPath (QPointF startPoint)
 
 
 QPainterPath (QPainterPath other)
 
 
virtual void CreateProxy ()
 
new void AddEllipse (QRectF rect)
 
 
new void AddEllipse (QPointF center, double rx, double ry)
 
 
new void AddEllipse (double x, double y, double w, double h)
 
 
new void AddPath (QPainterPath path)
 
 
new void AddPolygon (QPolygonF polygon)
 
 
new void AddRect (QRectF rect)
 
 
new void AddRect (double x, double y, double w, double h)
 
 
new void AddRegion (QRegion region)
 
 
new void AddRoundRect (QRectF rect, int roundness)
 
 
new void AddRoundRect (QRectF rect, int xRnd, int yRnd)
 
 
new void AddRoundRect (double x, double y, double w, double h, int roundness)
 
 
new void AddRoundRect (double x, double y, double w, double h, int xRnd, int yRnd)
 
 
new void AddRoundedRect (QRectF rect, double xRadius, double yRadius, Qt.SizeMode mode=Qt.SizeMode.AbsoluteSize)
 
 
new void AddRoundedRect (double x, double y, double w, double h, double xRadius, double yRadius, Qt.SizeMode mode=Qt.SizeMode.AbsoluteSize)
 
 
new void AddText (QPointF point, QFont f, string text)
 
 
new void AddText (double x, double y, QFont f, string text)
 
 
new double AngleAtPercent (double t)
 
 
new void ArcMoveTo (QRectF rect, double angle)
 
 
new void ArcMoveTo (double x, double y, double w, double h, double angle)
 
 
new void ArcTo (QRectF rect, double startAngle, double arcLength)
 
 
new void ArcTo (double x, double y, double w, double h, double startAngle, double arcLength)
 
 
new QRectF BoundingRect ()
 
 
new void CloseSubpath ()
 
 
new void ConnectPath (QPainterPath path)
 
 
new bool Contains (QPointF pt)
 
 
new bool Contains (QRectF rect)
 
 
new bool Contains (QPainterPath p)
 
 
new QRectF ControlPointRect ()
 
 
new void CubicTo (QPointF ctrlPt1, QPointF ctrlPt2, QPointF endPt)
 
 
new void CubicTo (double ctrlPt1x, double ctrlPt1y, double ctrlPt2x, double ctrlPt2y, double endPtx, double endPty)
 
 
new QPointF CurrentPosition ()
 
 
new QPainterPath.Element ElementAt (int i)
 
 
new int ElementCount ()
 
 
new QPainterPath Intersected (QPainterPath r)
 
 
new bool Intersects (QRectF rect)
 
 
new bool Intersects (QPainterPath p)
 
 
new bool IsEmpty ()
 
 
new double Length ()
 
 
new void LineTo (QPointF p)
 
 
new void LineTo (double x, double y)
 
 
new void MoveTo (QPointF p)
 
 
new void MoveTo (double x, double y)
 
 
new double PercentAtLength (double t)
 
 
new QPointF PointAtPercent (double t)
 
 
new void QuadTo (QPointF ctrlPt, QPointF endPt)
 
 
new void QuadTo (double ctrlPtx, double ctrlPty, double endPtx, double endPty)
 
 
new void SetElementPositionAt (int i, double x, double y)
 
 
new QPainterPath Simplified ()
 
 
new double SlopeAtPercent (double t)
 
 
new QPainterPath Subtracted (QPainterPath r)
 
 
new QPainterPath SubtractedInverted (QPainterPath r)
 
 
new void Swap (QPainterPath other)
 
 
new QPolygonF ToFillPolygon ()
 
 
new QPolygonF ToFillPolygon (QMatrix matrix)
 
 
new QPolygonF ToFillPolygon (QTransform matrix)
 
 
new
System.Collections.Generic.List
< QPolygonF
ToFillPolygons ()
 
 
new
System.Collections.Generic.List
< QPolygonF
ToFillPolygons (QMatrix matrix)
 
 
new
System.Collections.Generic.List
< QPolygonF
ToFillPolygons (QTransform matrix)
 
 
new QPainterPath ToReversed ()
 
 
new
System.Collections.Generic.List
< QPolygonF
ToSubpathPolygons ()
 
 
new
System.Collections.Generic.List
< QPolygonF
ToSubpathPolygons (QMatrix matrix)
 
 
new
System.Collections.Generic.List
< QPolygonF
ToSubpathPolygons (QTransform matrix)
 
 
new void Translate (QPointF offset)
 
 
new void Translate (double dx, double dy)
 
 
new QPainterPath Translated (QPointF offset)
 
 
new QPainterPath Translated (double dx, double dy)
 
 
new QPainterPath United (QPainterPath r)
 
 
new void Dispose ()
 

Static Public Member Functions

static QPainterPath operator* (QPainterPath arg1, QMatrix arg2)
 
static QPainterPath operator* (QPainterPath arg1, QTransform arg2)
 
static bool operator!= (QPainterPath arg1, QPainterPath arg2)
 
 
static QPainterPath operator& (QPainterPath arg1, QPainterPath arg2)
 
 
static QPainterPath operator+ (QPainterPath arg1, QPainterPath arg2)
 
 
static QPainterPath operator- (QPainterPath arg1, QPainterPath arg2)
 
 
static bool operator== (QPainterPath arg1, QPainterPath arg2)
 
 
static QPainterPath operator| (QPainterPath arg1, QPainterPath arg2)
 
 

Protected Member Functions

 QPainterPath (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

new Qt.FillRule FillRule [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QPainterPath class provides a container for painting operations, enabling graphical shapes to be constructed and reused.

A painter path is an object composed of a number of graphical building blocks, such as rectangles, ellipses, lines, and curves. Building blocks can be joined in closed subpaths, for example as a rectangle or an ellipse. A closed path has coinciding start and end points. Or they can exist independently as unclosed subpaths, such as lines and curves.

A QPainterPath object can be used for filling, outlining, and clipping. To generate fillable outlines for a given painter path, use the QPainterPathStroker class. The main advantage of painter paths over normal drawing operations is that complex shapes only need to be created once; then they can be drawn many times using only calls to the QPainter::drawPath() function.

QPainterPath provides a collection of functions that can be used to obtain information about the path and its elements. In addition it is possible to reverse the order of the elements using the toReversed() function. There are also several functions to convert this painter path object into a polygon representation.

Composing a QPainterPath

A QPainterPath object can be constructed as an empty path, with a given start point, or as a copy of another QPainterPath object. Once created, lines and curves can be added to the path using the lineTo(), arcTo(), cubicTo() and quadTo() functions. The lines and curves stretch from the currentPosition() to the position passed as argument.

The currentPosition() of the QPainterPath object is always the end position of the last subpath that was added (or the initial start point). Use the moveTo() function to move the currentPosition() without adding a component. The moveTo() function implicitly starts a new subpath, and closes the previous one. Another way of starting a new subpath is to call the closeSubpath() function which closes the current path by adding a line from the currentPosition() back to the path's start position. Note that the new path will have (0, 0) as its initial currentPosition().

QPainterPath class also provides several convenience functions to add closed subpaths to a painter path: addEllipse(), addPath(), addRect(), addRegion() and addText(). The addPolygon() function adds an unclosed subpath. In fact, these functions are all collections of moveTo(), lineTo() and cubicTo() operations.

In addition, a path can be added to the current path using the connectPath() function. But note that this function will connect the last element of the current path to the first element of given one by adding a line.

Below is a code snippet that shows how a QPainterPath object can be used:

QPainterPath path;

path.addRect(20, 20, 60, 60);

path.moveTo(0, 0);

path.cubicTo(99, 0, 50, 50, 99, 99);

path.cubicTo(0, 99, 50, 50, 0, 0);

QPainter painter(this);

painter.fillRect(0, 0, 100, 100, Qt::white);

painter.setPen(QPen(QColor(79, 106, 25), 1, Qt::SolidLine,

Qt::FlatCap, Qt::MiterJoin));

painter.setBrush(QColor(122, 163, 39));

painter.drawPath(path);

The painter path is initially empty when constructed. We first add a rectangle, which is a closed subpath. Then we add two bezier curves which together form a closed subpath even though they are not closed individually. Finally we draw the entire path. The path is filled using the default fill rule, Qt::OddEvenFill. Qt provides two methods for filling paths:

Qt::OddEvenFillQt::WindingFill

See the Qt::FillRule documentation for the definition of the rules. A painter path's currently set fill rule can be retrieved using the fillRule() function, and altered using the setFillRule() function.

QPainterPath Information

The QPainterPath class provides a collection of functions that returns information about the path and its elements.

The currentPosition() function returns the end point of the last subpath that was added (or the initial start point). The elementAt() function can be used to retrieve the various subpath elements, the number of elements can be retrieved using the elementCount() function, and the isEmpty() function tells whether this QPainterPath object contains any elements at all.

The controlPointRect() function returns the rectangle containing all the points and control points in this path. This function is significantly faster to compute than the exact boundingRect() which returns the bounding rectangle of this painter path with floating point precision.

Finally, QPainterPath provides the contains() function which can be used to determine whether a given point or rectangle is inside the path, and the intersects() function which determines if any of the points inside a given rectangle also are inside this path.

QPainterPath Conversion

For compatibility reasons, it might be required to simplify the representation of a painter path: QPainterPath provides the toFillPolygon(), toFillPolygons() and toSubpathPolygons() functions which convert the painter path into a polygon. The toFillPolygon() returns the painter path as one single polygon, while the two latter functions return a list of polygons.

The toFillPolygons() and toSubpathPolygons() functions are provided because it is usually faster to draw several small polygons than to draw one large polygon, even though the total number of points drawn is the same. The difference between the two is the number of polygons they return: The toSubpathPolygons() creates one polygon for each subpath regardless of intersecting subpaths (i.e. overlapping bounding rectangles), while the toFillPolygons() functions creates only one polygon for overlapping subpaths.

The toFillPolygon() and toFillPolygons() functions first convert all the subpaths to polygons, then uses a rewinding technique to make sure that overlapping subpaths can be filled using the correct fill rule. Note that rewinding inserts additional lines in the polygon so the outline of the fill polygon does not match the outline of the path.

Examples

Qt provides the Painter Paths Example and the Vector Deformation Demo which are located in Qt's example and demo directories respectively.

The Painter Paths Example shows how painter paths can be used to build complex shapes for rendering and lets the user experiment with the filling and stroking. The Vector Deformation Demo shows how to use QPainterPath to draw text.

Painter Paths ExampleVector Deformation Demo

See also QPainterPathStroker, QPainter, QRegion, and Painter Paths Example.

Member Enumeration Documentation

This enum describes the types of elements used to connect vertices in subpaths.

Note that elements added as closed subpaths using the addEllipse(), addPath(), addPolygon(), addRect(), addRegion() and addText() convenience functions, is actually added to the path as a collection of separate elements using the moveTo(), lineTo() and cubicTo() functions.

See also elementAt() and elementCount().

Enumerator:
CurveToDataElement 

The extra data required to describe a curve in a CurveToElement element.

CurveToElement 

A curve. See also cubicTo() and quadTo().

LineToElement 

A line. See also lineTo().

MoveToElement 

A new subpath. See also moveTo().

Constructor & Destructor Documentation

QtGui.QPainterPath.QPainterPath ( System.Type  dummy)
protected
QtGui.QPainterPath.QPainterPath ( )

Constructs an empty QPainterPath object.

QtGui.QPainterPath.QPainterPath ( QPointF  startPoint)

Creates a QPainterPath object with the given startPoint as its current position.

QtGui.QPainterPath.QPainterPath ( QPainterPath  other)

Creates a QPainterPath object that is a copy of the given path.

See also operator=().

Member Function Documentation

new void QtGui.QPainterPath.AddEllipse ( QRectF  rect)

Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed subpath.

The ellipse is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position).

QLinearGradient myGradient;

QPen myPen;

QRectF boundingRectangle;

QPainterPath myPath;

myPath.addEllipse(boundingRectangle);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new void QtGui.QPainterPath.AddEllipse ( QPointF  center,
double  rx,
double  ry 
)

Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed subpath.

The ellipse is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position).

QLinearGradient myGradient;

QPen myPen;

QRectF boundingRectangle;

QPainterPath myPath;

myPath.addEllipse(boundingRectangle);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new void QtGui.QPainterPath.AddEllipse ( double  x,
double  y,
double  w,
double  h 
)

Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed subpath.

The ellipse is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position).

QLinearGradient myGradient;

QPen myPen;

QRectF boundingRectangle;

QPainterPath myPath;

myPath.addEllipse(boundingRectangle);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new void QtGui.QPainterPath.AddPath ( QPainterPath  path)

Adds the given path to this path as a closed subpath.

See also connectPath() and Composing a QPainterPath.

new void QtGui.QPainterPath.AddPolygon ( QPolygonF  polygon)

Adds the given polygon to the path as an (unclosed) subpath.

Note that the current position after the polygon has been added, is the last point in polygon. To draw a line back to the first point, use the closeSubpath() function.

QLinearGradient myGradient;

QPen myPen;

QPolygonF myPolygon;

QPainterPath myPath;

myPath.addPolygon(myPolygon);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new void QtGui.QPainterPath.AddRect ( QRectF  rect)

Adds the given rectangle to this path as a closed subpath.

The rectangle is added as a clockwise set of lines. The painter path's current position after the rectangle has been added is at the top-left corner of the rectangle.

QLinearGradient myGradient;

QPen myPen;

QRectF myRectangle;

QPainterPath myPath;

myPath.addRect(myRectangle);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new void QtGui.QPainterPath.AddRect ( double  x,
double  y,
double  w,
double  h 
)

Adds the given rectangle to this path as a closed subpath.

The rectangle is added as a clockwise set of lines. The painter path's current position after the rectangle has been added is at the top-left corner of the rectangle.

QLinearGradient myGradient;

QPen myPen;

QRectF myRectangle;

QPainterPath myPath;

myPath.addRect(myRectangle);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new void QtGui.QPainterPath.AddRegion ( QRegion  region)

Adds the given region to the path by adding each rectangle in the region as a separate closed subpath.

See also addRect() and Composing a QPainterPath.

new void QtGui.QPainterPath.AddRoundedRect ( QRectF  rect,
double  xRadius,
double  yRadius,
Qt.SizeMode  mode = Qt.SizeMode.AbsoluteSize 
)

Adds the given rectangle rect with rounded corners to the path.

The xRadius and yRadius arguments specify the radii of the ellipses defining the corners of the rounded rectangle. When mode is Qt::RelativeSize, xRadius and yRadius are specified in percentage of half the rectangle's width and height respectively, and should be in the range 0.0 to 100.0.

This function was introduced in Qt 4.4.

See also addRect().

new void QtGui.QPainterPath.AddRoundedRect ( double  x,
double  y,
double  w,
double  h,
double  xRadius,
double  yRadius,
Qt.SizeMode  mode = Qt.SizeMode.AbsoluteSize 
)

Adds the given rectangle rect with rounded corners to the path.

The xRadius and yRadius arguments specify the radii of the ellipses defining the corners of the rounded rectangle. When mode is Qt::RelativeSize, xRadius and yRadius are specified in percentage of half the rectangle's width and height respectively, and should be in the range 0.0 to 100.0.

This function was introduced in Qt 4.4.

See also addRect().

new void QtGui.QPainterPath.AddRoundRect ( QRectF  rect,
int  roundness 
)

Adds a rectangle r with rounded corners to the path.

The xRnd and yRnd arguments specify how rounded the corners should be. 0 is angled corners, 99 is maximum roundedness.

See also addRoundedRect().

new void QtGui.QPainterPath.AddRoundRect ( QRectF  rect,
int  xRnd,
int  yRnd 
)

Adds a rectangle r with rounded corners to the path.

The xRnd and yRnd arguments specify how rounded the corners should be. 0 is angled corners, 99 is maximum roundedness.

See also addRoundedRect().

new void QtGui.QPainterPath.AddRoundRect ( double  x,
double  y,
double  w,
double  h,
int  roundness 
)

Adds a rectangle r with rounded corners to the path.

The xRnd and yRnd arguments specify how rounded the corners should be. 0 is angled corners, 99 is maximum roundedness.

See also addRoundedRect().

new void QtGui.QPainterPath.AddRoundRect ( double  x,
double  y,
double  w,
double  h,
int  xRnd,
int  yRnd 
)

Adds a rectangle r with rounded corners to the path.

The xRnd and yRnd arguments specify how rounded the corners should be. 0 is angled corners, 99 is maximum roundedness.

See also addRoundedRect().

new void QtGui.QPainterPath.AddText ( QPointF  point,
QFont  f,
string  text 
)

Adds the given text to this path as a set of closed subpaths created from the font supplied. The subpaths are positioned so that the left end of the text's baseline lies at the specified point.

QLinearGradient myGradient;

QPen myPen;

QFont myFont;

QPointF baseline(x, y);

QPainterPath myPath;

myPath.addText(baseline, myFont, tr("Qt"));

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new void QtGui.QPainterPath.AddText ( double  x,
double  y,
QFont  f,
string  text 
)

Adds the given text to this path as a set of closed subpaths created from the font supplied. The subpaths are positioned so that the left end of the text's baseline lies at the specified point.

QLinearGradient myGradient;

QPen myPen;

QFont myFont;

QPointF baseline(x, y);

QPainterPath myPath;

myPath.addText(baseline, myFont, tr("Qt"));

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new double QtGui.QPainterPath.AngleAtPercent ( double  t)

Returns the angle of the path tangent at the percentage t. The argument t has to be between 0 and 1.

Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

Note that similarly to the other percent methods, the percentage measurement is not linear with regards to the length if curves are present in the path. When curves are present the percentage argument is mapped to the t parameter of the Bezier equations.

new void QtGui.QPainterPath.ArcMoveTo ( QRectF  rect,
double  angle 
)

Creates a move to that lies on the arc that occupies the given rectangle at angle.

Angles are specified in degrees. Clockwise arcs can be specified using negative angles.

This function was introduced in Qt 4.2.

See also moveTo() and arcTo().

new void QtGui.QPainterPath.ArcMoveTo ( double  x,
double  y,
double  w,
double  h,
double  angle 
)

Creates a move to that lies on the arc that occupies the given rectangle at angle.

Angles are specified in degrees. Clockwise arcs can be specified using negative angles.

This function was introduced in Qt 4.2.

See also moveTo() and arcTo().

new void QtGui.QPainterPath.ArcTo ( QRectF  rect,
double  startAngle,
double  arcLength 
)

Creates an arc that occupies the given rectangle, beginning at the specified startAngle and extending sweepLength degrees counter-clockwise.

Angles are specified in degrees. Clockwise arcs can be specified using negative angles.

Note that this function connects the starting point of the arc to the current position if they are not already connected. After the arc has been added, the current position is the last point in arc. To draw a line back to the first point, use the closeSubpath() function.

QLinearGradient myGradient;

QPen myPen;

QPointF center, startPoint;

QPainterPath myPath;

myPath.moveTo(center);

myPath.arcTo(boundingRect, startAngle,

sweepLength);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new void QtGui.QPainterPath.ArcTo ( double  x,
double  y,
double  w,
double  h,
double  startAngle,
double  arcLength 
)

Creates an arc that occupies the given rectangle, beginning at the specified startAngle and extending sweepLength degrees counter-clockwise.

Angles are specified in degrees. Clockwise arcs can be specified using negative angles.

Note that this function connects the starting point of the arc to the current position if they are not already connected. After the arc has been added, the current position is the last point in arc. To draw a line back to the first point, use the closeSubpath() function.

QLinearGradient myGradient;

QPen myPen;

QPointF center, startPoint;

QPainterPath myPath;

myPath.moveTo(center);

myPath.arcTo(boundingRect, startAngle,

sweepLength);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new QRectF QtGui.QPainterPath.BoundingRect ( )

Returns the bounding rectangle of this painter path as a rectangle with floating point precision.

See also controlPointRect().

new void QtGui.QPainterPath.CloseSubpath ( )

Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting a new path. The current point of the new path is (0, 0).

If the subpath does not contain any elements, this function does nothing.

See also moveTo() and Composing a QPainterPath.

new void QtGui.QPainterPath.ConnectPath ( QPainterPath  path)

Connects the given path to this path by adding a line from the last element of this path to the first element of the given path.

See also addPath() and Composing a QPainterPath.

new bool QtGui.QPainterPath.Contains ( QPointF  pt)

Returns true if the given point is inside the path, otherwise returns false.

See also intersects().

new bool QtGui.QPainterPath.Contains ( QRectF  rect)

Returns true if the given rectangle is inside the path, otherwise returns false.

new bool QtGui.QPainterPath.Contains ( QPainterPath  p)

Returns true if the given path p is contained within the current path. Returns false if any edges of the current path and p intersect.

Set operations on paths will treat the paths as areas. Non-closed paths will be treated as implicitly closed.

This function was introduced in Qt 4.3.

See also intersects().

new QRectF QtGui.QPainterPath.ControlPointRect ( )

Returns the rectangle containing all the points and control points in this path.

This function is significantly faster to compute than the exact boundingRect(), and the returned rectangle is always a superset of the rectangle returned by boundingRect().

See also boundingRect().

virtual void QtGui.QPainterPath.CreateProxy ( )
virtual
new void QtGui.QPainterPath.CubicTo ( QPointF  ctrlPt1,
QPointF  ctrlPt2,
QPointF  endPt 
)

Adds a cubic Bezier curve between the current position and the given endPoint using the control points specified by c1, and c2.

After the curve is added, the current position is updated to be at the end point of the curve.

QLinearGradient myGradient;

QPen myPen;

QPainterPath myPath;

myPath.cubicTo(c1, c2, endPoint);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new void QtGui.QPainterPath.CubicTo ( double  ctrlPt1x,
double  ctrlPt1y,
double  ctrlPt2x,
double  ctrlPt2y,
double  endPtx,
double  endPty 
)

Adds a cubic Bezier curve between the current position and the given endPoint using the control points specified by c1, and c2.

After the curve is added, the current position is updated to be at the end point of the curve.

QLinearGradient myGradient;

QPen myPen;

QPainterPath myPath;

myPath.cubicTo(c1, c2, endPoint);

QPainter painter(this);

painter.setBrush(myGradient);

painter.setPen(myPen);

painter.drawPath(myPath);

new QPointF QtGui.QPainterPath.CurrentPosition ( )

Returns the current position of the path.

new void QtGui.QPainterPath.Dispose ( )
new QPainterPath.Element QtGui.QPainterPath.ElementAt ( int  i)

Returns the element at the given index in the painter path.

See also ElementType, elementCount(), and isEmpty().

new int QtGui.QPainterPath.ElementCount ( )

Returns the number of path elements in the painter path.

See also ElementType, elementAt(), and isEmpty().

override bool QtGui.QPainterPath.Equals ( object  o)
override int QtGui.QPainterPath.GetHashCode ( )
new QPainterPath QtGui.QPainterPath.Intersected ( QPainterPath  r)

Returns a path which is the intersection of this path's fill area and p's fill area. Bezier curves may be flattened to line segments due to numerical instability of doing bezier curve intersections.

This function was introduced in Qt 4.3.

new bool QtGui.QPainterPath.Intersects ( QRectF  rect)

Returns true if any point in the given rectangle intersects the path; otherwise returns false.

There is an intersection if any of the lines making up the rectangle crosses a part of the path or if any part of the rectangle overlaps with any area enclosed by the path. This function respects the current fillRule to determine what is considered inside the path.

See also contains().

new bool QtGui.QPainterPath.Intersects ( QPainterPath  p)

Returns true if the current path intersects at any point the given path p. Also returns true if the current path contains or is contained by any part of p.

Set operations on paths will treat the paths as areas. Non-closed paths will be treated as implicitly closed.

This function was introduced in Qt 4.3.

See also contains().

new bool QtGui.QPainterPath.IsEmpty ( )

Returns true if either there are no elements in this path, or if the only element is a MoveToElement; otherwise returns false.

See also elementCount().

new double QtGui.QPainterPath.Length ( )

Returns the length of the current path.

new void QtGui.QPainterPath.LineTo ( QPointF  p)

Adds a straight line from the current position to the given endPoint. After the line is drawn, the current position is updated to be at the end point of the line.

See also addPolygon(), addRect(), and Composing a QPainterPath.

new void QtGui.QPainterPath.LineTo ( double  x,
double  y 
)

Adds a straight line from the current position to the given endPoint. After the line is drawn, the current position is updated to be at the end point of the line.

See also addPolygon(), addRect(), and Composing a QPainterPath.

new void QtGui.QPainterPath.MoveTo ( QPointF  p)

Moves the current point to the given point, implicitly starting a new subpath and closing the previous one.

See also closeSubpath() and Composing a QPainterPath.

new void QtGui.QPainterPath.MoveTo ( double  x,
double  y 
)

Moves the current point to the given point, implicitly starting a new subpath and closing the previous one.

See also closeSubpath() and Composing a QPainterPath.

static bool QtGui.QPainterPath.operator!= ( QPainterPath  arg1,
QPainterPath  arg2 
)
static

Returns true if this painter path differs from the given path.

Note that comparing paths may involve a per element comparison which can be slow for complex paths.

See also operator==().

static QPainterPath QtGui.QPainterPath.operator& ( QPainterPath  arg1,
QPainterPath  arg2 
)
static

Returns the intersection of this path and the other path.

This function was introduced in Qt 4.5.

See also intersected(), operator&=(), united(), and operator|().

static QPainterPath QtGui.QPainterPath.operator* ( QPainterPath  arg1,
QMatrix  arg2 
)
static
static QPainterPath QtGui.QPainterPath.operator* ( QPainterPath  arg1,
QTransform  arg2 
)
static
static QPainterPath QtGui.QPainterPath.operator+ ( QPainterPath  arg1,
QPainterPath  arg2 
)
static

Returns the union of this path and the other path. This function is equivalent to operator|().

This function was introduced in Qt 4.5.

See also united(), operator+=(), and operator-().

static QPainterPath QtGui.QPainterPath.operator- ( QPainterPath  arg1,
QPainterPath  arg2 
)
static

Subtracts the other path from a copy of this path, and returns the copy.

This function was introduced in Qt 4.5.

See also subtracted(), operator-=(), and operator+().

static bool QtGui.QPainterPath.operator== ( QPainterPath  arg1,
QPainterPath  arg2 
)
static

Returns true if this painterpath is equal to the given path.

Note that comparing paths may involve a per element comparison which can be slow for complex paths.

See also operator!=().

static QPainterPath QtGui.QPainterPath.operator| ( QPainterPath  arg1,
QPainterPath  arg2 
)
static

Returns the union of this path and the other path.

This function was introduced in Qt 4.5.

See also united(), operator|=(), intersected(), and operator&().

new double QtGui.QPainterPath.PercentAtLength ( double  t)

Returns percentage of the whole path at the specified length len.

Note that similarly to other percent methods, the percentage measurement is not linear with regards to the length, if curves are present in the path. When curves are present the percentage argument is mapped to the t parameter of the Bezier equations.

new QPointF QtGui.QPainterPath.PointAtPercent ( double  t)

Returns the point at at the percentage t of the current path. The argument t has to be between 0 and 1.

Note that similarly to other percent methods, the percentage measurement is not linear with regards to the length, if curves are present in the path. When curves are present the percentage argument is mapped to the t parameter of the Bezier equations.

new void QtGui.QPainterPath.QuadTo ( QPointF  ctrlPt,
QPointF  endPt 
)

Adds a quadratic Bezier curve between the current position and the given endPoint with the control point specified by c.

After the curve is added, the current point is updated to be at the end point of the curve.

See also cubicTo() and Composing a QPainterPath.

new void QtGui.QPainterPath.QuadTo ( double  ctrlPtx,
double  ctrlPty,
double  endPtx,
double  endPty 
)

Adds a quadratic Bezier curve between the current position and the given endPoint with the control point specified by c.

After the curve is added, the current point is updated to be at the end point of the curve.

See also cubicTo() and Composing a QPainterPath.

new void QtGui.QPainterPath.SetElementPositionAt ( int  i,
double  x,
double  y 
)

Sets the x and y coordinate of the element at index index to x and y.

This function was introduced in Qt 4.2.

new QPainterPath QtGui.QPainterPath.Simplified ( )

Returns a simplified version of this path. This implies merging all subpaths that intersect, and returning a path containing no intersecting edges. Consecutive parallel lines will also be merged. The simplified path will always use the default fill rule, Qt::OddEvenFill. Bezier curves may be flattened to line segments due to numerical instability of doing bezier curve intersections.

This function was introduced in Qt 4.4.

new double QtGui.QPainterPath.SlopeAtPercent ( double  t)

Returns the slope of the path at the percentage t. The argument t has to be between 0 and 1.

Note that similarly to other percent methods, the percentage measurement is not linear with regards to the length, if curves are present in the path. When curves are present the percentage argument is mapped to the t parameter of the Bezier equations.

new QPainterPath QtGui.QPainterPath.Subtracted ( QPainterPath  r)

Returns a path which is p's fill area subtracted from this path's fill area.

Set operations on paths will treat the paths as areas. Non-closed paths will be treated as implicitly closed. Bezier curves may be flattened to line segments due to numerical instability of doing bezier curve intersections.

This function was introduced in Qt 4.3.

new QPainterPath QtGui.QPainterPath.SubtractedInverted ( QPainterPath  r)

Use subtracted() instead.

This function was introduced in Qt 4.3.

See also subtracted().

new void QtGui.QPainterPath.Swap ( QPainterPath  other)

Swaps painter path other with this painter path. This operation is very fast and never fails.

This function was introduced in Qt 4.8.

new QPolygonF QtGui.QPainterPath.ToFillPolygon ( )

Converts the path into a polygon using the QTransform matrix, and returns the polygon.

The polygon is created by first converting all subpaths to polygons, then using a rewinding technique to make sure that overlapping subpaths can be filled using the correct fill rule.

Note that rewinding inserts addition lines in the polygon so the outline of the fill polygon does not match the outline of the path.

See also toSubpathPolygons(), toFillPolygons(), and QPainterPath Conversion.

new QPolygonF QtGui.QPainterPath.ToFillPolygon ( QMatrix  matrix)

Converts the path into a polygon using the QTransform matrix, and returns the polygon.

The polygon is created by first converting all subpaths to polygons, then using a rewinding technique to make sure that overlapping subpaths can be filled using the correct fill rule.

Note that rewinding inserts addition lines in the polygon so the outline of the fill polygon does not match the outline of the path.

See also toSubpathPolygons(), toFillPolygons(), and QPainterPath Conversion.

new QPolygonF QtGui.QPainterPath.ToFillPolygon ( QTransform  matrix)

Converts the path into a polygon using the QTransform matrix, and returns the polygon.

The polygon is created by first converting all subpaths to polygons, then using a rewinding technique to make sure that overlapping subpaths can be filled using the correct fill rule.

Note that rewinding inserts addition lines in the polygon so the outline of the fill polygon does not match the outline of the path.

See also toSubpathPolygons(), toFillPolygons(), and QPainterPath Conversion.

new System.Collections.Generic.List<QPolygonF> QtGui.QPainterPath.ToFillPolygons ( )

Converts the path into a list of polygons using the QTransform matrix, and returns the list.

The function differs from the toFillPolygon() function in that it creates several polygons. It is provided because it is usually faster to draw several small polygons than to draw one large polygon, even though the total number of points drawn is the same.

The toFillPolygons() function differs from the toSubpathPolygons() function in that it create only polygon for subpaths that have overlapping bounding rectangles.

Like the toFillPolygon() function, this function uses a rewinding technique to make sure that overlapping subpaths can be filled using the correct fill rule. Note that rewinding inserts addition lines in the polygons so the outline of the fill polygon does not match the outline of the path.

See also toSubpathPolygons(), toFillPolygon(), and QPainterPath Conversion.

new System.Collections.Generic.List<QPolygonF> QtGui.QPainterPath.ToFillPolygons ( QMatrix  matrix)

Converts the path into a list of polygons using the QTransform matrix, and returns the list.

The function differs from the toFillPolygon() function in that it creates several polygons. It is provided because it is usually faster to draw several small polygons than to draw one large polygon, even though the total number of points drawn is the same.

The toFillPolygons() function differs from the toSubpathPolygons() function in that it create only polygon for subpaths that have overlapping bounding rectangles.

Like the toFillPolygon() function, this function uses a rewinding technique to make sure that overlapping subpaths can be filled using the correct fill rule. Note that rewinding inserts addition lines in the polygons so the outline of the fill polygon does not match the outline of the path.

See also toSubpathPolygons(), toFillPolygon(), and QPainterPath Conversion.

new System.Collections.Generic.List<QPolygonF> QtGui.QPainterPath.ToFillPolygons ( QTransform  matrix)

Converts the path into a list of polygons using the QTransform matrix, and returns the list.

The function differs from the toFillPolygon() function in that it creates several polygons. It is provided because it is usually faster to draw several small polygons than to draw one large polygon, even though the total number of points drawn is the same.

The toFillPolygons() function differs from the toSubpathPolygons() function in that it create only polygon for subpaths that have overlapping bounding rectangles.

Like the toFillPolygon() function, this function uses a rewinding technique to make sure that overlapping subpaths can be filled using the correct fill rule. Note that rewinding inserts addition lines in the polygons so the outline of the fill polygon does not match the outline of the path.

See also toSubpathPolygons(), toFillPolygon(), and QPainterPath Conversion.

new QPainterPath QtGui.QPainterPath.ToReversed ( )

Creates and returns a reversed copy of the path.

It is the order of the elements that is reversed: If a QPainterPath is composed by calling the moveTo(), lineTo() and cubicTo() functions in the specified order, the reversed copy is composed by calling cubicTo(), lineTo() and moveTo().

new System.Collections.Generic.List<QPolygonF> QtGui.QPainterPath.ToSubpathPolygons ( )

Converts the path into a list of polygons using the QTransform matrix, and returns the list.

This function creates one polygon for each subpath regardless of intersecting subpaths (i.e. overlapping bounding rectangles). To make sure that such overlapping subpaths are filled correctly, use the toFillPolygons() function instead.

See also toFillPolygons(), toFillPolygon(), and QPainterPath Conversion.

new System.Collections.Generic.List<QPolygonF> QtGui.QPainterPath.ToSubpathPolygons ( QMatrix  matrix)

Converts the path into a list of polygons using the QTransform matrix, and returns the list.

This function creates one polygon for each subpath regardless of intersecting subpaths (i.e. overlapping bounding rectangles). To make sure that such overlapping subpaths are filled correctly, use the toFillPolygons() function instead.

See also toFillPolygons(), toFillPolygon(), and QPainterPath Conversion.

new System.Collections.Generic.List<QPolygonF> QtGui.QPainterPath.ToSubpathPolygons ( QTransform  matrix)

Converts the path into a list of polygons using the QTransform matrix, and returns the list.

This function creates one polygon for each subpath regardless of intersecting subpaths (i.e. overlapping bounding rectangles). To make sure that such overlapping subpaths are filled correctly, use the toFillPolygons() function instead.

See also toFillPolygons(), toFillPolygon(), and QPainterPath Conversion.

new void QtGui.QPainterPath.Translate ( QPointF  offset)

This is an overloaded function.

Translates all elements in the path by the given offset.

This function was introduced in Qt 4.6.

See also translated().

new void QtGui.QPainterPath.Translate ( double  dx,
double  dy 
)

Translates all elements in the path by (dx, dy).

This function was introduced in Qt 4.6.

See also translated().

new QPainterPath QtGui.QPainterPath.Translated ( QPointF  offset)

This is an overloaded function.

Returns a copy of the path that is translated by the given offset.

This function was introduced in Qt 4.6.

See also translate().

new QPainterPath QtGui.QPainterPath.Translated ( double  dx,
double  dy 
)

Returns a copy of the path that is translated by (dx, dy).

This function was introduced in Qt 4.6.

See also translate().

new QPainterPath QtGui.QPainterPath.United ( QPainterPath  r)

Returns a path which is the union of this path's fill area and p's fill area.

Set operations on paths will treat the paths as areas. Non-closed paths will be treated as implicitly closed. Bezier curves may be flattened to line segments due to numerical instability of doing bezier curve intersections.

This function was introduced in Qt 4.3.

See also intersected() and subtracted().

Member Data Documentation

SmokeInvocation QtGui.QPainterPath.interceptor
protected

Property Documentation

new Qt.FillRule QtGui.QPainterPath.FillRule
getset

Returns the painter path's currently set fill rule.

Sets the fill rule of the painter path to the given fillRule. Qt provides two methods for filling paths:

Qt::OddEvenFill (default)Qt::WindingFill

virtual System.IntPtr QtGui.QPainterPath.SmokeObject
getset