ShapeMaker Class Reference

A utility class for building polygons out of SVG commands. More...

#include <ShapeMaker.h>

List of all members.

Public Member Functions

 ShapeMaker ()
 Constructor.
 ~ShapeMaker ()
 Destructor.
void setTransformation (const MATRIX2D &aTransformation)
 Sets the transformation matrix.
void setColor (unsigned int aColor)
 Sets the current color.
void setFillRule (RENDERER_FILLMODE aFillMode)
 Sets the current fillrule.
bool newShape ()
 Starts a new shape and clears the shape data collected this far.
bool beginPath ()
 Begins a new path.
bool endPath ()
 Ends the path.
bool moveToAbsolute (const VECTOR2D &aPosition)
 Moves the draw head to an absolute position.
bool moveToRelative (const VECTOR2D &aPosition)
 Moves the draw head to a position relative to the previous one.
bool lineToAbsolute (const VECTOR2D &aPosition)
 Draws a line to an absolute position.
bool lineToRelative (const VECTOR2D &aPosition)
 Draws a line to a position relative to the previous one.
bool horizontalLineToAbsolute (RATIONAL aX)
 Draws a horizontal line to the new x coordinate.
bool horizontalLineToRelative (RATIONAL aX)
 Draws a horizontal line to the new x coordinate, relative to the previous point.
bool verticalLineToAbsolute (RATIONAL aY)
 Draws a vertical line to the new y coordinate.
bool verticalLineToRelative (RATIONAL aY)
 Draws a vertical line to the new y coordinate, relative to the previous point.
bool curveToAbsolute (const VECTOR2D &aPoint1, const VECTOR2D &aPoint2, const VECTOR2D &aPosition)
 Draws a cubic bezier curve to point aPosition, using aPoint1 and aPoint2 as control points.
bool curveToRelative (const VECTOR2D &aPoint1, const VECTOR2D &aPoint2, const VECTOR2D &aPosition)
 Draws a cubic bezier curve to point aPosition, using aPoint1 and aPoint2 as control points.
bool smoothCurveToAbsolute (const VECTOR2D &aPoint2, const VECTOR2D &aPosition)
 Draws a cubic bezier curve to point aPosition, mirroring the first control point from the previous curveTo command and using aPoint2 as second control point.
bool smoothCurveToRelative (const VECTOR2D &aPoint2, const VECTOR2D &aPosition)
 Draws a cubic bezier curve to point aPosition, mirroring the first control point from the previous curveTo command and using aPoint2 as second control point.
bool quadraticCurveToAbsolute (const VECTOR2D &aPoint, const VECTOR2D &aPosition)
 Draws a quadratic bezier curve to point aPosition, using aPoint as the control point.
bool quadraticCurveToRelative (const VECTOR2D &aPoint, const VECTOR2D &aPosition)
 Draws a quadratic bezier curve to point aPosition, using aPoint as the control point.
bool smoothQuadraticCurveToAbsolute (const VECTOR2D &aPosition)
 Draws a quadratic bezier curve to point aPosition, mirroring the control point from the previous curveTo command.
bool smoothQuadraticCurveToRelative (const VECTOR2D &aPosition)
 Draws a quadratic bezier curve to point aPosition, mirroring the control point from the previous curveTo command.
bool closePath ()
 Closes the path being drawn.
void setBezierSteps (int aSteps)
 Sets the amount of bezier steps.
const ShapeMaker::ShapeDatagetShapeData () const
 Returns a pointer to the shape data gathered since the last call to newShape().

Protected Member Functions

bool moveTo (const VECTOR2D &aPosition)
 Moves the internal cursor to a new position.
bool edgeTo (const VECTOR2D &aPosition)
 Draws an edge from the previous position to a new position.

Protected Attributes

ShapeDatamShapeData
MATRIX2D mTransformation
unsigned int mCurrentColor
RENDERER_FILLMODE mCurrentFillMode
int mBezierSteps
VECTOR2D mCurrentPoint
VECTOR2D mCurrentControlPoint
VECTOR2D mStartPoint
VECTOR2D mInternalCursorPos
bool mInternalCursorMove

Classes

class  ShapeData
 Inner class for handling the path data as a set of polygons. More...


Detailed Description

A utility class for building polygons out of SVG commands.


Constructor & Destructor Documentation

ShapeMaker::ShapeMaker  ) 
 

Constructor.

ShapeMaker::~ShapeMaker  ) 
 

Destructor.


Member Function Documentation

bool ShapeMaker::beginPath  ) 
 

Begins a new path.

bool ShapeMaker::closePath  ) 
 

Closes the path being drawn.

bool ShapeMaker::curveToAbsolute const VECTOR2D &  aPoint1,
const VECTOR2D &  aPoint2,
const VECTOR2D &  aPosition
 

Draws a cubic bezier curve to point aPosition, using aPoint1 and aPoint2 as control points.

bool ShapeMaker::curveToRelative const VECTOR2D &  aPoint1,
const VECTOR2D &  aPoint2,
const VECTOR2D &  aPosition
 

Draws a cubic bezier curve to point aPosition, using aPoint1 and aPoint2 as control points.

bool ShapeMaker::edgeTo const VECTOR2D &  aPosition  )  [protected]
 

Draws an edge from the previous position to a new position.

This uses the transformed coordinates.

bool ShapeMaker::endPath  ) 
 

Ends the path.

const ShapeMaker::ShapeData * ShapeMaker::getShapeData  )  const
 

Returns a pointer to the shape data gathered since the last call to newShape().

bool ShapeMaker::horizontalLineToAbsolute RATIONAL  aX  ) 
 

Draws a horizontal line to the new x coordinate.

bool ShapeMaker::horizontalLineToRelative RATIONAL  aX  ) 
 

Draws a horizontal line to the new x coordinate, relative to the previous point.

bool ShapeMaker::lineToAbsolute const VECTOR2D &  aPosition  ) 
 

Draws a line to an absolute position.

bool ShapeMaker::lineToRelative const VECTOR2D &  aPosition  ) 
 

Draws a line to a position relative to the previous one.

bool ShapeMaker::moveTo const VECTOR2D &  aPosition  )  [protected]
 

Moves the internal cursor to a new position.

This uses the transformed coordinates.

bool ShapeMaker::moveToAbsolute const VECTOR2D &  aPosition  ) 
 

Moves the draw head to an absolute position.

bool ShapeMaker::moveToRelative const VECTOR2D &  aPosition  ) 
 

Moves the draw head to a position relative to the previous one.

bool ShapeMaker::newShape  ) 
 

Starts a new shape and clears the shape data collected this far.

This must be called as the first thing before assigning any commands to the shape maker.

bool ShapeMaker::quadraticCurveToAbsolute const VECTOR2D &  aPoint,
const VECTOR2D &  aPosition
 

Draws a quadratic bezier curve to point aPosition, using aPoint as the control point.

bool ShapeMaker::quadraticCurveToRelative const VECTOR2D &  aPoint,
const VECTOR2D &  aPosition
 

Draws a quadratic bezier curve to point aPosition, using aPoint as the control point.

void ShapeMaker::setBezierSteps int  aSteps  ) 
 

Sets the amount of bezier steps.

void ShapeMaker::setColor unsigned int  aColor  ) 
 

Sets the current color.

Current color is applied to the path at beginPath().

void ShapeMaker::setFillRule RENDERER_FILLMODE  aFillMode  ) 
 

Sets the current fillrule.

Current fillrule is applied to the path at beginPath().

void ShapeMaker::setTransformation const MATRIX2D &  aTransformation  ) 
 

Sets the transformation matrix.

bool ShapeMaker::smoothCurveToAbsolute const VECTOR2D &  aPoint2,
const VECTOR2D &  aPosition
 

Draws a cubic bezier curve to point aPosition, mirroring the first control point from the previous curveTo command and using aPoint2 as second control point.

bool ShapeMaker::smoothCurveToRelative const VECTOR2D &  aPoint2,
const VECTOR2D &  aPosition
 

Draws a cubic bezier curve to point aPosition, mirroring the first control point from the previous curveTo command and using aPoint2 as second control point.

bool ShapeMaker::smoothQuadraticCurveToAbsolute const VECTOR2D &  aPosition  ) 
 

Draws a quadratic bezier curve to point aPosition, mirroring the control point from the previous curveTo command.

bool ShapeMaker::smoothQuadraticCurveToRelative const VECTOR2D &  aPosition  ) 
 

Draws a quadratic bezier curve to point aPosition, mirroring the control point from the previous curveTo command.

bool ShapeMaker::verticalLineToAbsolute RATIONAL  aY  ) 
 

Draws a vertical line to the new y coordinate.

bool ShapeMaker::verticalLineToRelative RATIONAL  aY  ) 
 

Draws a vertical line to the new y coordinate, relative to the previous point.


Member Data Documentation

int ShapeMaker::mBezierSteps [protected]
 

unsigned int ShapeMaker::mCurrentColor [protected]
 

VECTOR2D ShapeMaker::mCurrentControlPoint [protected]
 

RENDERER_FILLMODE ShapeMaker::mCurrentFillMode [protected]
 

VECTOR2D ShapeMaker::mCurrentPoint [protected]
 

bool ShapeMaker::mInternalCursorMove [protected]
 

VECTOR2D ShapeMaker::mInternalCursorPos [protected]
 

ShapeData* ShapeMaker::mShapeData [protected]
 

VECTOR2D ShapeMaker::mStartPoint [protected]
 

MATRIX2D ShapeMaker::mTransformation [protected]
 


The documentation for this class was generated from the following files:
Generated on Fri Aug 3 00:44:41 2007 for Scanline edge-flag algorithm for antialiasing by  doxygen 1.4.6-NO