Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QPainterPath class specifies a vectorial graphical shape. More...
#include <QPainterPath>
The QPainterPath class specifies a vectorial graphical shape.
A painter path is an object composed of a number of graphical building blocks, such as rectangles, ellipses, lines and curves. A painter path can be used for filling, outlining, and for clipping. The main advantage of painter paths over normal drawing operations is that it is possible to build up non-linear shapes which can be drawn later one go.
Building blocks can be joined in closed sub-paths, such as a rectangle or an ellipse, or they can exist independently as unclosed sub-paths, although an unclosed path will not be filled.
Below is a code example on how a path can be used. The painter in this case has a pen width of 3 and a light blue brush. We first add a rectangle, which becomes a closed sub-path. We then add two bezier curves, and finally draw the entire path.
QPainterPath path; path.addRect(20, 20, 60, 60); path.addBezier(0, 0, 99, 0, 50, 50, 99, 99); path.addBezier(99, 99, 0, 99, 50, 50, 0, 0); painter.drawPath(path);
Specifies which method should be used to fill the path.
QPainterPath::OddEven | Specifies that the region is filled using the odd even fill rule. With this rule, one determines wheter a point is inside the path as follows: Draw a horizontal line from the point to outside the path and count the number of intersections. If the number of intersections is an odd number the point is inside the path. This mode is the default. |
QPainterPath::Winding | Specifies that the region is filled using the non zero winding rule. With this rule, one determines wheter a point is inside the path as follows: Draw a horizontal line from the path to the outside of the path. Determine the direction of the path in each intersection point, up or down. The winding number is determined by summing the direction of each intersection. If the number is non zero, the point is inside the path. This fill mode can also in most cases be considered as the intersection of closed shapes. |
Creates a new empty QPainterPath.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Adds a Bezier curve with control points p1, p2, p3, and p4, to the path.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Adds the Bezier curve specified by the point array pa to the path. The point array <b>must</b> contain exactly four points or the function will give a warning and do nothing.
Adds a straight line defined by the start point p1 and the end point p2 to the path.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Adds a straight line from the last point to point p.
Adds the given rect to the path. The rect is closed and is not considered to be part of the current subpath.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Begins a new subpath in the existing path. If the path has no elements this function does nothing. If a subpath is already in progress this function does not automatically close it.
See also closeSubpath().
Returns the bounding rectangle of this painter path
Closes the current subpath. If the subpath does not contain any elements, the function does nothing. A new subpath is automatically begun when the current subpath is closed.
See also beginSubpath().
Returns the fill mode of the painter path. The default fill mode is OddEven.
See also FillMode and setFillMode.
Copyright © 2004 Trolltech. | Trademarks | Qt 4.0.0-tp1 |