Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::BezierCurve Class Reference

The BezierCurve is a basic implementation of the Path interface and provides methods to create lines, rectangles, polylines, and curves. More...

#include <BezierCurve.h>

Inheritance diagram for VCF::BezierCurve:

VCF::Object VCF::Path VCF::Interface List of all members.

Public Member Functions

 BezierCurve ()
virtual ~BezierCurve ()
virtual void applyTransform (const Matrix2D &transform)
 Applies the transform to the path.
virtual bool contains (const Rect &rect)
 Returns true or false, depending on whether or not the path includes, or contains, the specified rectangle.
virtual bool contains (const Point &pt)
 Returns true or false, depending on whether or not the path includes, or contains, the specified point.
virtual bool intersects (const Point &pt)
 Returns true or false, depending on whether or not the specified point intersects any part of the path.
virtual bool intersects (const Rect &rect)
 Returns true or false, depending on whether or not the specified rectangle intersects any part of the path.
virtual Rect getBounds ()
 returns the smallest rectangular bounds that fully enclose this path
virtual WindingRule getWindingRule ()
 Returns the winding rule for the path.
virtual void setWindingRule (WindingRule rule)
virtual bool getPoints (std::vector< PathPoint > &points, Matrix2D *transform)
 This fills in the points vector with a series of all the points that make up the path.
virtual void flattenPoints (std::vector< Point > &flattenedPoints)
 This does the same thing as getPoints(), only it "flattens" the path if neccessary.
void curveTo (const double &cx1, const double &cy1, const double &cx2, const double &cy2, const double &x, const double &y)
 Adds a curve to path, using the last point in path as the start point for the curve.
void curve (const double &x1, const double &y1, const double &cx1, const double &cy1, const double &cx2, const double &cy2, const double &x2, const double &y2)
 Adds a curve to path.
void lineTo (const double &x, const double &y)
 makes a line from the last point in the path
void moveTo (const double &x, const double &y)
 adds a non connected point to the path
void rectangle (const Rect &rectangle)
 adds a rectangle to the path
void polyTo (std::vector< Point > &points)
 adds a series of lines to the path in the form of a polyline starting with the last point in the path.
void polyline (std::vector< Point > &points)
 adds a series of lines to the path in the form of a polyline.
void close ()
 closes the path.
void clear ()
 removes all points from the path

Protected Attributes

Path::WindingRule windingRule_
int32 currentMoveToIndex_
std::vector< PathPointpoints_

Detailed Description

The BezierCurve is a basic implementation of the Path interface and provides methods to create lines, rectangles, polylines, and curves.

See also:
Path


Constructor & Destructor Documentation

VCF::BezierCurve::BezierCurve  ) 
 

virtual VCF::BezierCurve::~BezierCurve  )  [virtual]
 


Member Function Documentation

virtual void VCF::BezierCurve::applyTransform const Matrix2D transform  )  [virtual]
 

Applies the transform to the path.

Implements VCF::Path.

void VCF::BezierCurve::clear  ) 
 

removes all points from the path

void VCF::BezierCurve::close  ) 
 

closes the path.

virtual bool VCF::BezierCurve::contains const Point pt  )  [virtual]
 

Returns true or false, depending on whether or not the path includes, or contains, the specified point.

Returns:
bool Returns true if the point is within the bounds of the shape, otherwise false.

Implements VCF::Path.

virtual bool VCF::BezierCurve::contains const Rect rect  )  [virtual]
 

Returns true or false, depending on whether or not the path includes, or contains, the specified rectangle.

Returns:
bool Returns true if the rect is within the bounds of the shape, otherwise false.

Implements VCF::Path.

void VCF::BezierCurve::curve const double &  x1,
const double &  y1,
const double &  cx1,
const double &  cy1,
const double &  cx2,
const double &  cy2,
const double &  x2,
const double &  y2
 

Adds a curve to path.

Parameters:
double represents the x coordinate of the start point of the curve
double represents the y coordinate of the start point of the curve
double represents the x coordinate of the 1st control point
double represents the y coordinate of the 1st control point
double represents the x coordinate of the 2nd control point
double represents the y coordinate of the 2nd control point
double represents the x coordinate of the end point of the curve
double represents the y coordinate of the end point of the curve

void VCF::BezierCurve::curveTo const double &  cx1,
const double &  cy1,
const double &  cx2,
const double &  cy2,
const double &  x,
const double &  y
 

Adds a curve to path, using the last point in path as the start point for the curve.

Parameters:
double represents the x coordinate of the 1st control point
double represents the y coordinate of the 1st control point
double represents the x coordinate of the 2nd control point
double represents the y coordinate of the 2nd control point
double represents the x coordinate of the end point of the curve
double represents the y coordinate of the end point of the curve

virtual void VCF::BezierCurve::flattenPoints std::vector< Point > &  flattenedPoints  )  [virtual]
 

This does the same thing as getPoints(), only it "flattens" the path if neccessary.

For example, if you had a path that was a bezier curve, it might be made of 4 points, the start point, 1st control point, 2nd control point, and end point. Calling getPoints would returns these 4 points, where as calling flattenPoints() would "flatten" the curve, and return a series of points that approximate the curve. How closely the flattened points approximate the curve is entirely up to the implementor of the Path class.

Implements VCF::Path.

virtual Rect VCF::BezierCurve::getBounds  )  [virtual]
 

returns the smallest rectangular bounds that fully enclose this path

Implements VCF::Path.

virtual bool VCF::BezierCurve::getPoints std::vector< PathPoint > &  points,
Matrix2D transform
[virtual]
 

This fills in the points vector with a series of all the points that make up the path.

If the path were to describe a rectangle, then more than likely the points parameter would be filled with 4 points for the 4 corners of the rectangle.

Parameters:
std::vector<PathPoint> 
Matrix2D a pointer to an affine matrix. This matrix is used to apply a transformation to the returned points. It does not modify the path. The matrix instance is optional, and may be NULL.
Returns:
bool returns true if the points vector is non empty (i.e. points.emtpy() == false).

Implements VCF::Path.

virtual WindingRule VCF::BezierCurve::getWindingRule  )  [inline, virtual]
 

Returns the winding rule for the path.

This affects how the path get rendered.

Implements VCF::Path.

virtual bool VCF::BezierCurve::intersects const Rect rect  )  [virtual]
 

Returns true or false, depending on whether or not the specified rectangle intersects any part of the path.

Returns:
bool Returns true if the rectangle intersects the shape, otherwise false.

Implements VCF::Path.

virtual bool VCF::BezierCurve::intersects const Point pt  )  [virtual]
 

Returns true or false, depending on whether or not the specified point intersects any part of the path.

Returns:
bool Returns true if the point intersects the shape, otherwise false.

Implements VCF::Path.

void VCF::BezierCurve::lineTo const double &  x,
const double &  y
 

makes a line from the last point in the path

void VCF::BezierCurve::moveTo const double &  x,
const double &  y
 

adds a non connected point to the path

void VCF::BezierCurve::polyline std::vector< Point > &  points  ) 
 

adds a series of lines to the path in the form of a polyline.

Parameters:
std::vector<Point> the points to add to the path

void VCF::BezierCurve::polyTo std::vector< Point > &  points  ) 
 

adds a series of lines to the path in the form of a polyline starting with the last point in the path.

Parameters:
std::vector<Point> the points to add to the path

void VCF::BezierCurve::rectangle const Rect rectangle  ) 
 

adds a rectangle to the path

virtual void VCF::BezierCurve::setWindingRule WindingRule  rule  )  [inline, virtual]
 


Member Data Documentation

int32 VCF::BezierCurve::currentMoveToIndex_ [protected]
 

std::vector<PathPoint> VCF::BezierCurve::points_ [protected]
 

Path::WindingRule VCF::BezierCurve::windingRule_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information