Wt::WPainterPath Class Reference
[Painting system]

Helper class for composing a (complex) path. More...

#include <Wt/WPainterPath>

List of all members.

Public Member Functions

 WPainterPath ()
 Default constructor.
 WPainterPath (const WPointF &startPoint)
 Construct a new path, and set the initial position.
 WPainterPath (const WPainterPath &path)
 Copy constructor.
WPainterPathoperator= (const WPainterPath &path)
 Assignment operator.
WPointF currentPosition () const
 Return the current position.
bool isEmpty () const
 Returns whether the path is empty.
bool operator== (const WPainterPath &path) const
 Comparison operator.
bool operator!= (const WPainterPath &path) const
 Comparison operator.
void closeSubPath ()
 Close the last sub path.
void moveTo (const WPointF &point)
 Moves the current position to a new location.
void moveTo (double x, double y)
 Moves the current position to a new location.
void lineTo (const WPointF &point)
 Draws a straight line.
void lineTo (double x, double y)
 Draws a straight line.
void cubicTo (const WPointF &c1, const WPointF &c2, const WPointF &endPoint)
 Draws a cubic bezier curve.
void cubicTo (double c1x, double c1y, double c2x, double c2y, double endPointx, double endPointy)
 Draws a cubic bezier curve.
void arcTo (double cx, double cy, double radius, double startAngle, double sweepLength)
 Draws an arc.
void arcTo (double x, double y, double width, double height, double startAngle, double sweepLength)
 Draws an arc.
void arcMoveTo (double cx, double cy, double radius, double angle)
 Move to a point on an arc.
void arcMoveTo (double x, double y, double width, double height, double angle)
 Move to a point on an arc.
void quadTo (const WPointF &c, const WPointF &endPoint)
 Draw a quadratic bezier curve.
void quadTo (double cx, double cy, double endPointx, double endPointy)
 Draw a quadratic bezier curve.
void addEllipse (const WRectF &boundingRectangle)
 Draw an ellipse.
void addEllipse (double x, double y, double width, double height)
 Draw an ellipse.
void addRect (const WRectF &rectangle)
 Draw a rectangle.
void addRect (double x, double y, double width, double height)
 Draw a rectangle.
void addPath (const WPainterPath &path)
 Add a path.
void connectPath (const WPainterPath &path)
 Add a path, connecting.
WRectF controlPointRect () const
 Returns the bounding box of the control points.


Detailed Description

Helper class for composing a (complex) path.

The path that is composed in a painter path may consist of multiple closed sub-paths. Only the last sub-path can be left open.

A WPainterPath maintains a current position, and the path is composed by defining drawing operations, which draw a line (see lineTo()), arc (see arcTo()), or bezier curve (see quadTo() and cubicTo()) from the current position to a new position. A new sub path may be started by moving the current position to a new location (see moveTo()), which automatically closes the previous sub path.

When sub paths overlap, the result is undefined (it is dependent on the underlying painting device).

See also:
WPainter::drawPath(const WPainterPath&)

Constructor & Destructor Documentation

Wt::WPainterPath::WPainterPath (  ) 

Default constructor.

Creates an empty path, and sets the current position to (0, 0).

Wt::WPainterPath::WPainterPath ( const WPointF startPoint  ) 

Construct a new path, and set the initial position.

Creates an empty path, and sets the current position to startPoint.


Member Function Documentation

WPointF Wt::WPainterPath::currentPosition (  )  const

Return the current position.

Returns the current position, which is the end point of the last move or draw operation, and which well be the start point of the next draw operation.

bool Wt::WPainterPath::isEmpty (  )  const

Returns whether the path is empty.

Returns true if the path contains no drawing operations.

bool Wt::WPainterPath::operator== ( const WPainterPath path  )  const

Comparison operator.

Returns true if the paths are exactly the same.

bool Wt::WPainterPath::operator!= ( const WPainterPath path  )  const

Comparison operator.

Returns true if the paths are different.

void Wt::WPainterPath::closeSubPath (  ) 

Close the last sub path.

Draws a line from the current position to the start position of the last sub path (which is the end point of the last move operation), and sets the current position to (0, 0).

void Wt::WPainterPath::moveTo ( const WPointF point  ) 

Moves the current position to a new location.

Moves the current position to a new point, implicitly closing the last sub path.

See also:
closeSubPath(), moveTo(double, double)

void Wt::WPainterPath::moveTo ( double  x,
double  y 
)

Moves the current position to a new location.

Moves the current position to a new point, implicitly closing the last sub path.

See also:
closeSubPath(), moveTo(double, double)

void Wt::WPainterPath::lineTo ( const WPointF point  ) 

Draws a straight line.

Draws a straight line from the current position to point, which becomes the new current position.

See also:
lineTo(double, double)

void Wt::WPainterPath::lineTo ( double  x,
double  y 
)

Draws a straight line.

Draws a straight line from the current position to (x, y), which becomes the new current position.

See also:
lineTo(const WPointF&)

void Wt::WPainterPath::cubicTo ( const WPointF c1,
const WPointF c2,
const WPointF endPoint 
)

Draws a cubic bezier curve.

Draws a cubic bezier curve from the current position to endPoint, which becomes the new current position. The bezier curve uses the two control points c1 and c2.

See also:
cubicTo(double c1x, double c1y, double c2x, double c2y, double endPointx, double endPointy)

void Wt::WPainterPath::cubicTo ( double  c1x,
double  c1y,
double  c2x,
double  c2y,
double  endPointx,
double  endPointy 
)

Draws a cubic bezier curve.

This is an overloaded method provided for convenience.

See also:
cubicTo(const WPointF&, const WPointF&, const WPointF&)

void Wt::WPainterPath::arcTo ( double  cx,
double  cy,
double  radius,
double  startAngle,
double  sweepLength 
)

Draws an arc.

Draws an arc which is a segment of a circle. The circle is defined with center (cx, cy) and radius. The segment starts at startAngle, and spans an angle given by spanAngle. These angles are expressed in degrees, and are measured counter-clockwise starting from the 3 o'clock position.

Implicitly draws a line from the current position to the start of the arc, if the current position is different from the start.

See also:
arcMoveTo(double cx, double cy, double radius, double angle)

void Wt::WPainterPath::arcTo ( double  x,
double  y,
double  width,
double  height,
double  startAngle,
double  sweepLength 
)

Draws an arc.

Draws an arc which is a segment of an ellipse, which fits in the rectangle defined by top left position (x, y), and size width x height. The segment starts at startAngle, and spans an angle given by spanAngle. These angles are expressed in degrees, and are measured counter-clockwise starting from the 3 o'clock position.

See also:
arcMoveTo(double cx, double cy, double radius, double startAngle, double sweepLength)
Deprecated:
Use arcTo(double cx, double cy, double radius, double startAngle, double sweepLength) instead since ot all renderers support elliptical segments (width != height).

void Wt::WPainterPath::arcMoveTo ( double  cx,
double  cy,
double  radius,
double  angle 
)

Move to a point on an arc.

Moves to a point on a circle. The circle is defined with center (cx, cy) and radius, and the point is at angle degrees measured counter-clockwise starting from the 3 o'clock position.

See also:
arcTo(double cx, double cy, double radius, double startAngle, double sweepLength)

void Wt::WPainterPath::arcMoveTo ( double  x,
double  y,
double  width,
double  height,
double  angle 
)

Move to a point on an arc.

Moves to a point on an ellipse. The ellipse fits in the rectangle defined by top left position (x, y), and size width x height, and the point is at angle degrees measured counter-clockwise starting from the 3 o'clock position.

See also:
arcTo(double x, double y, double width, double height, double startAngle, double sweepLength)

void Wt::WPainterPath::quadTo ( const WPointF c,
const WPointF endPoint 
)

Draw a quadratic bezier curve.

Draws a quadratic bezier curve from the current position to endPoint, which becomes the new current position. The bezier curve uses the single control point c.

See also:
quadTo(double cx, double cy, double endPointx, double endPointy)

void Wt::WPainterPath::quadTo ( double  cx,
double  cy,
double  endPointx,
double  endPointy 
)

Draw a quadratic bezier curve.

This is an overloaded method provided for convenience.

See also:
quadTo(const WPointF&, const WPointF&)

void Wt::WPainterPath::addEllipse ( const WRectF boundingRectangle  ) 

Draw an ellipse.

This method closes the current sub path, and adds an ellipse that is bounded by the rectangle boundingRectangle.

Note: some renderers only support circles (width == height)

See also:
addEllipse(double x, double y, double width, double height), arcTo()

void Wt::WPainterPath::addEllipse ( double  x,
double  y,
double  width,
double  height 
)

Draw an ellipse.

This method closes the current sub path, and adds an ellipse that is bounded by the rectangle defined by top left position (x, y), and size width x height.

Note: some renderers only support circles (width == height)

See also:
addEllipse(const WRectF&), arcTo()

void Wt::WPainterPath::addRect ( const WRectF rectangle  ) 

Draw a rectangle.

This method closes the current sub path, and adds a rectangle that is defined by rectangle.

See also:
addRect(double x, double y, double width, double height)

void Wt::WPainterPath::addRect ( double  x,
double  y,
double  width,
double  height 
)

Draw a rectangle.

This method closes the current sub path, and adds a rectangle that is defined by top left position (x, y), and size width x height.

See also:
addRect(const WRectF&)

void Wt::WPainterPath::addPath ( const WPainterPath path  ) 

Add a path.

Adds an entire path to the current path. If the path's begin position is different from the current position, the last sub path is first closed, otherwise the last sub path is extended with the path's first sub path.

See also:
connectPath(const WPainterPath&)

void Wt::WPainterPath::connectPath ( const WPainterPath path  ) 

Add a path, connecting.

Adds an entire path to the current path. If the path's begin position is different from the current position, the last sub path is first closed, otherwise the last sub path is extended with the path's first sub path.

See also:
connectPath(const WPainterPath&)

WRectF Wt::WPainterPath::controlPointRect (  )  const

Returns the bounding box of the control points.

Returns the bounding box of all control points. This is guaranteed to be a superset of the actual bounding box.


Generated on Fri Jul 25 17:56:38 2008 for Wt by doxygen 1.5.3