ipe::Painter Class Reference
Ipe Base

`#include <ipepainter.h>`

Inherited by DecorationPainter, IpeQtPainter, ipe::BBoxPainter, ipe::CairoPainter, and ipe::PdfPainter.

## Classes

struct | State

## Public Member Functions

| Painter (const Cascade *style)
virtual | ~Painter ()
void | setAttributeMap (const AttributeMap *map)
Attribute | lookup (Kind kind, Attribute sym) const
void | transform (const Matrix &m)
void | untransform (TTransformations trans)
void | translate (const Vector &v)
void | push ()
void | pop ()
void | pushMatrix ()
void | popMatrix ()
void | newPath ()
void | moveTo (const Vector &v)
void | lineTo (const Vector &v)
void | curveTo (const Vector &v1, const Vector &v2, const Vector &v3)
void | curveTo (const Bezier &bezier)
void | rect (const Rect &re)
void | drawEllipse ()
void | drawArc (const Arc &arc)
void | closePath ()
void | drawPath (TPathMode mode)
void | drawBitmap (Bitmap bitmap)
void | drawText (const Text *text)
void | drawSymbol (Attribute symbol)
void | addClipPath ()
void | setStroke (Attribute color)
void | setFill (Attribute color)
void | setPen (Attribute pen)
void | setDashStyle (Attribute dash)
void | setLineCap (TLineCap cap)
void | setLineJoin (TLineJoin join)
void | setFillRule (TFillRule rule)
void | setSymStroke (Attribute color)
void | setSymFill (Attribute color)
void | setSymPen (Attribute wid)
void | setOpacity (Attribute opaq)
void | setStrokeOpacity (Attribute opaq)
void | setTiling (Attribute til)
void | setGradient (Attribute grad)
const Cascade * | cascade () const
Color | stroke () const
Color | fill () const
const Matrix & | matrix () const
Fixed | pen () const
String | dashStyle () const
void | dashStyle (std::vector< double > &dashes, double &offset) const
TLineCap | lineCap () const
TLineJoin | lineJoin () const
TFillRule | fillRule () const
Color | symStroke () const
Color | symFill () const
Fixed | symPen () const
Fixed | opacity () const
Fixed | strokeOpacity () const
Attribute | tiling () const
Attribute | gradient () const
const State & | state () const
void | setState (const State &state)

## Protected Member Functions

virtual void | doPush ()
virtual void | doPop ()
virtual void | doNewPath ()
virtual void | doMoveTo (const Vector &v)
virtual void | doLineTo (const Vector &v)
virtual void | doCurveTo (const Vector &v1, const Vector &v2, const Vector &v3)
virtual void | doDrawArc (const Arc &arc)
virtual void | doClosePath ()
virtual void | doDrawPath (TPathMode mode)
virtual void | doDrawBitmap (Bitmap bitmap)
virtual void | doDrawText (const Text *text)
virtual void | doDrawSymbol (Attribute symbol)
virtual void | doAddClipPath ()
void | drawArcAsBezier (double alpha)

## Protected Attributes

std::list< State > | iState
std::list< Matrix > | iMatrix
const Cascade * | iCascade
const AttributeMap * | iAttributeMap
int | iInPath

## Detailed Description

Interface for drawing.

Painter-derived classes are used for drawing to the screen and for generating PDF and Postscript output.

The Painter maintains a stack of graphics states, which includes stroke and fill color, line width, dash style, miter limit, line cap and line join. It also maintains a separate stack of transformation matrices. The Painter class takes care of maintaining the stacks, and setting of the attributes in the current graphics state.

Setting an attribute with a symbolic value is resolved immediately using the stylesheet Cascade attached to the Painter, so calling the stroke() or fill() methods of Painter will return the current absolute color.

It's okay to set symbolic attributes that the stylesheet does not define - they are set to a default absolute value (black, solid, etc.).

The painter is either in "general" or in "path construction" mode. The newPath() member starts path construction mode. In this mode, only the path construction operators (moveTo, lineTo, curveTo, rect, drawArc, closePath), the transformation operators (transform, untransform, translate), and the matrix stack operators (pushMatrix, popMatrix) are admissible. The path is drawn using drawPath, this ends path construction mode. Path construction operators cannot be used in general mode.

The graphics state for a path must be set before starting path construction mode, that is, before calling newPath().

Derived classes need to implement the doXXX functions for drawing paths, images, and texts. The transformation matrix has already been applied to the coordinates passed to the doXXX functions.

## Constructor & Destructor Documentation

## Painter()

Painter::Painter | ( | const Cascade * | style | ) |

Constructor takes a (cascaded) style sheet, which is not owned.

The initial graphics state contains all default attributes.

References ipe::EPen, ipe::Cascade::fillRule(), ipe::Cascade::find(), iAttributeMap, iCascade, ipe::Painter::State::iDashStyle, ipe::Painter::State::iFill, ipe::Painter::State::iFillRule, ipe::Painter::State::iGradient, iInPath, ipe::Painter::State::iLineCap, ipe::Painter::State::iLineJoin, iMatrix, ipe::Painter::State::iOpacity, ipe::Painter::State::iPen, iState, ipe::Painter::State::iStroke, ipe::Painter::State::iStrokeOpacity, ipe::Painter::State::iSymFill, ipe::Painter::State::iSymPen, ipe::Painter::State::iSymStroke, ipe::Painter::State::iTiling, ipe::Cascade::lineCap(), ipe::Cascade::lineJoin(), ipe::Attribute::NORMAL(), ipe::Attribute::number(), and state().

## ~Painter()

Painter::~Painter | ( |  | ) |

virtual

Virtual destructor.

## Member Function Documentation

## setAttributeMap()

void Painter::setAttributeMap | ( | const AttributeMap * | map | ) |

Set a new attribute map.

References iAttributeMap.

Referenced by ipe::CanvasBase::drawObjects(), ipe::Thumbnail::render(), and ipe::Thumbnail::saveRender().

## lookup()

Attribute Painter::lookup | ( | Kind | kind,
|  | Attribute | sym
| ) |  | const

Lookup a symbolic attribute.

Uses first the attribute map and then the stylesheet.

References ipe::Cascade::find(), iAttributeMap, iCascade, ipe::Attribute::isSymbolic(), and ipe::AttributeMap::map().

Referenced by ipe::Reference::draw(), setDashStyle(), setFill(), setOpacity(), setPen(), setStroke(), setStrokeOpacity(), setSymFill(), setSymPen(), and setSymStroke().

## transform()

void Painter::transform | ( | const Matrix & | m | ) |

Concatenate a matrix to current transformation matrix.

References iMatrix, and matrix().

Referenced by doDrawArc(), ipe::PdfPainter::doDrawText(), ipe::CairoPainter::doDrawText(), ipe::Group::draw(), ipe::Reference::draw(), ipe::Text::draw(), ipe::TransformTool::draw(), ipe::Image::draw(), ipe::Path::draw(), ipe::Path::drawArrow(), ipe::CanvasBase::drawObjects(), Canvas::drawRect(), ipe::Group::drawSimple(), ipe::Reference::drawSimple(), ipe::Text::drawSimple(), ipe::Image::drawSimple(), ipe::Path::drawSimple(), ipe::Thumbnail::render(), and ipe::Thumbnail::saveRender().

## untransform()

void Painter::untransform | ( | TTransformations | trans | ) |

Reset transformation to original one, but with different origin/direction.

This changes the current transformation matrix to the one set before the first push operation, but maintaining the current origin. Only the operations allowed in allowed are applied.

References ipe::Matrix::a, ipe::ETransformationsAffine, ipe::ETransformationsRigidMotions, iMatrix, ipe::Linear::inverse(), matrix(), and ipe::Matrix::translation().

Referenced by ipe::Group::draw(), ipe::Reference::draw(), ipe::Text::draw(), ipe::Image::draw(), ipe::Path::draw(), ipe::Path::drawArrow(), ipe::Group::drawSimple(), ipe::Reference::drawSimple(), ipe::Text::drawSimple(), ipe::Image::drawSimple(), and ipe::Path::drawSimple().

## translate()

void Painter::translate | ( | const Vector & | v | ) |

Concatenate a translation to current transformation matrix.

References ipe::Matrix::a, iMatrix, matrix(), ipe::Vector::x, and ipe::Vector::y.

Referenced by ipe::PdfPainter::doDrawText(), ipe::CairoPainter::doDrawText(), ipe::Reference::draw(), ipe::Text::draw(), ipe::PanTool::draw(), ipe::Path::drawArrow(), ipe::Reference::drawSimple(), and ipe::Text::drawSimple().

## push()

void Painter::push | ( |  | ) |

Save current graphics state.

Cannot be called in path construction mode.

References doPush(), iInPath, iState, and state().

Referenced by ipe::Group::draw(), ipe::Reference::draw(), ipe::Text::draw(), ipe::Image::draw(), ipe::Path::draw(), ipe::Path::drawArrow(), ipe::Group::drawSimple(), and ipe::Reference::drawSimple().

## pop()

void Painter::pop | ( |  | ) |

Restore previous graphics state.

Cannot be called in path construction mode.

References doPop(), iInPath, and iState.

Referenced by ipe::Group::draw(), ipe::Reference::draw(), ipe::Text::draw(), ipe::Image::draw(), ipe::Path::draw(), ipe::Path::drawArrow(), ipe::Group::drawSimple(), and ipe::Reference::drawSimple().

## pushMatrix()

void Painter::pushMatrix | ( |  | ) |

Save current transformation matrix.

References iMatrix, and matrix().

Referenced by doDrawArc(), ipe::PdfPainter::doDrawText(), ipe::Group::draw(), ipe::Reference::draw(), ipe::Text::draw(), ipe::Image::draw(), ipe::Path::draw(), ipe::Path::drawArrow(), ipe::CanvasBase::drawObjects(), Canvas::drawRect(), ipe::Group::drawSimple(), ipe::Reference::drawSimple(), ipe::Text::drawSimple(), ipe::Image::drawSimple(), ipe::Path::drawSimple(), ipe::Thumbnail::render(), and ipe::Thumbnail::saveRender().

## popMatrix()

void Painter::popMatrix | ( |  | ) |

Restore previous transformation matrix.

References iMatrix.

Referenced by doDrawArc(), ipe::PdfPainter::doDrawText(), ipe::Group::draw(), ipe::Reference::draw(), ipe::Text::draw(), ipe::Image::draw(), ipe::Path::draw(), ipe::Path::drawArrow(), ipe::CanvasBase::drawObjects(), Canvas::drawRect(), ipe::Group::drawSimple(), ipe::Reference::drawSimple(), ipe::Text::drawSimple(), ipe::Image::drawSimple(), ipe::Path::drawSimple(), ipe::Thumbnail::render(), and ipe::Thumbnail::saveRender().

## newPath()

void Painter::newPath | ( |  | ) |

Enter path construction mode.

References doNewPath(), iInPath, and iState.

Referenced by ipe::Group::draw(), ipe::PanTool::draw(), ipe::SelectTool::draw(), ipe::Path::draw(), ipe::Path::drawArrow(), ipe::Group::drawSimple(), ipe::Reference::drawSimple(), ipe::Text::drawSimple(), ipe::Image::drawSimple(), and ipe::Path::drawSimple().

## moveTo()

void Painter::moveTo | ( | const Vector & | v | ) |

Start a new subpath.

References doMoveTo(), iInPath, and matrix().

Referenced by doDrawArc(), ipe::ClosedSpline::draw(), ipe::Curve::draw(), ipe::Path::drawArrow(), ipe::Reference::drawSimple(), ipe::Text::drawSimple(), and rect().

## lineTo()

void Painter::lineTo | ( | const Vector & | v | ) |

Add line segment to current subpath.

References doLineTo(), iInPath, and matrix().

Referenced by ipe::CurveSegment::draw(), ipe::Path::drawArrow(), ipe::Reference::drawSimple(), ipe::Text::drawSimple(), and rect().

## curveTo() [1/2]

void Painter::curveTo | ( | const Vector & | v1,
|  | const Vector & | v2,
|  | const Vector & | v3
| ) |  |

Add a Bezier segment to current subpath.

References doCurveTo(), iInPath, and matrix().

Referenced by curveTo(), ipe::CurveSegment::draw(), ipe::ClosedSpline::draw(), and drawArcAsBezier().

## curveTo() [2/2]

void ipe::Painter::curveTo | ( | const Bezier & | bezier | ) |

inline

Overloaded function.

Assumes current position is `bezier.iV`[0]

References curveTo(), and ipe::Bezier::iV.

## rect()

void Painter::rect | ( | const Rect & | re | ) |

Add a rectangle subpath to the path.

This is implemented in terms of moveTo() and lineTo().

References ipe::Rect::bottomLeft(), ipe::Rect::bottomRight(), closePath(), lineTo(), moveTo(), ipe::Rect::topLeft(), and ipe::Rect::topRight().

Referenced by ipe::PanTool::draw(), ipe::SelectTool::draw(), and ipe::Image::drawSimple().

## drawEllipse()

void ipe::Painter::drawEllipse | ( |  | ) |

## drawArc()

void Painter::drawArc | ( | const Arc & | arc | ) |

Add an elliptic arc to current path.

Assumes the current point is arc.beginp().

References doDrawArc(), and iInPath.

Referenced by ipe::CurveSegment::draw(), ipe::Ellipse::draw(), ipe::SelectTool::draw(), and ipe::Path::drawArrow().

## closePath()

void Painter::closePath | ( |  | ) |

Close the current subpath.

References doClosePath(), and iInPath.

Referenced by ipe::ClosedSpline::draw(), ipe::Curve::draw(), ipe::SelectTool::draw(), ipe::Path::drawArrow(), ipe::Text::drawSimple(), and rect().

## drawPath()

void Painter::drawPath | ( | TPathMode | mode | ) |

Fill and/or stroke a path.

As in PDF, a "path" can consist of several subpaths. Whether it is filled or stroked depends on mode.

References doDrawPath(), and iInPath.

Referenced by ipe::PanTool::draw(), ipe::SelectTool::draw(), ipe::Path::draw(), ipe::Path::drawArrow(), ipe::Reference::drawSimple(), ipe::Text::drawSimple(), ipe::Image::drawSimple(), and ipe::Path::drawSimple().

## drawBitmap()

void Painter::drawBitmap | ( | Bitmap | bitmap | ) |

Render a bitmap.

Assumes the transformation matrix has been set up to map the unit square to the image area on the paper.

References doDrawBitmap(), and iInPath.

Referenced by ipe::Image::draw().

## drawText()

void Painter::drawText | ( | const Text * | text | ) |

Render a text object.

Stroke color is already set, and the origin is the lower-left corner of the text box (not the reference point!).

References doDrawText(), and iInPath.

Referenced by ipe::Text::draw().

## drawSymbol()

void Painter::drawSymbol | ( | Attribute | symbol | ) |

Render a symbol.

The current coordinate system is already the symbol coordinate system. If the symbol is parameterized, then sym-stroke, sym-fill, and sym-pen are already set.

References doDrawSymbol(), and iInPath.

Referenced by ipe::Reference::draw(), and ipe::Thumbnail::saveRender().

## addClipPath()

void Painter::addClipPath | ( |  | ) |

Add current path as clip path.

References doAddClipPath(), and iInPath.

Referenced by ipe::Group::draw(), and ipe::Group::drawSimple().

## setStroke()

void Painter::setStroke | ( | Attribute | color | ) |

Set stroke color, resolving symbolic color and "sym-x" colors.

References ipe::Attribute::color(), ipe::EColor, iInPath, iState, lookup(), ipe::Attribute::SYM_FILL(), and ipe::Attribute::SYM_STROKE().

Referenced by ipe::Text::draw(), ipe::PanTool::draw(), ipe::SelectTool::draw(), ipe::TransformTool::draw(), ipe::Path::draw(), ipe::Path::drawArrow(), and ipe::CanvasBase::drawTool().

## setFill()

void Painter::setFill | ( | Attribute | color | ) |

Set fill color, resolving symbolic color.

References ipe::Attribute::color(), ipe::EColor, iInPath, iState, lookup(), ipe::Attribute::SYM_FILL(), and ipe::Attribute::SYM_STROKE().

Referenced by ipe::Path::draw(), and ipe::Path::drawArrow().

## setPen()

void Painter::setPen | ( | Attribute | pen | ) |

Set pen, resolving symbolic value.

References ipe::EPen, iInPath, iState, lookup(), ipe::Attribute::number(), pen(), and ipe::Attribute::SYM_PEN().

Referenced by ipe::Path::draw(), and ipe::CanvasBase::drawTool().

## setDashStyle()

void Painter::setDashStyle | ( | Attribute | dash | ) |

Set dash style, resolving symbolic value.

References ipe::EDashStyle, iInPath, iState, lookup(), and ipe::Attribute::string().

Referenced by ipe::Path::draw().

## setLineCap()

void Painter::setLineCap | ( | TLineCap | cap | ) |

Set line cap.

If cap is EDefaultCap, the current setting remains unchanged.

References ipe::EDefaultCap, iInPath, and iState.

Referenced by ipe::Path::draw().

## setLineJoin()

void Painter::setLineJoin | ( | TLineJoin | join | ) |

Set line join.

If join is EDefaultJoin, the current setting remains unchanged.

References ipe::EDefaultJoin, iInPath, and iState.

Referenced by ipe::Path::draw().

## setFillRule()

void Painter::setFillRule | ( | TFillRule | rule | ) |

Set fill rule (wind or even-odd).

If the rule is EDefaultRule, the current setting remains unchanged.

References ipe::EDefaultRule, iInPath, and iState.

Referenced by ipe::Path::draw().

## setSymStroke()

void Painter::setSymStroke | ( | Attribute | color | ) |

Set symbol stroke color, resolving symbolic color.

References ipe::Attribute::color(), ipe::EColor, iInPath, iState, lookup(), ipe::Attribute::SYM_FILL(), and ipe::Attribute::SYM_STROKE().

Referenced by ipe::Reference::draw(), and ipe::Path::drawArrow().

## setSymFill()

void Painter::setSymFill | ( | Attribute | color | ) |

Set symbol fill color, resolving symbolic color.

References ipe::Attribute::color(), ipe::EColor, iInPath, iState, lookup(), ipe::Attribute::SYM_FILL(), and ipe::Attribute::SYM_STROKE().

Referenced by ipe::Reference::draw(), and ipe::Path::drawArrow().

## setSymPen()

void Painter::setSymPen | ( | Attribute | wid | ) |

Set symbol pen, resolving symbolic pen.

References ipe::EPen, iInPath, iState, lookup(), ipe::Attribute::number(), pen(), and ipe::Attribute::SYM_PEN().

Referenced by ipe::Reference::draw(), and ipe::Path::drawArrow().

## setOpacity()

void Painter::setOpacity | ( | Attribute | opaq | ) |

Set opacity.

References ipe::EOpacity, iInPath, iState, lookup(), and ipe::Attribute::number().

Referenced by ipe::Text::draw(), ipe::Image::draw(), and ipe::Path::draw().

## setStrokeOpacity()

void Painter::setStrokeOpacity | ( | Attribute | opaq | ) |

Set stroke opacity.

References ipe::EOpacity, iInPath, iState, lookup(), and ipe::Attribute::number().

Referenced by ipe::Path::draw().

## setTiling()

void Painter::setTiling | ( | Attribute | tiling | ) |

Set tiling pattern.

If tiling is not `normal`, resets the gradient pattern.

References iInPath, ipe::Attribute::isNormal(), iState, ipe::Attribute::NORMAL(), and tiling().

Referenced by ipe::Path::draw().

## setGradient()

void Painter::setGradient | ( | Attribute | grad | ) |

Set gradient fill.

If grad is not `normal`, resets the tiling pattern.

References iInPath, ipe::Attribute::isNormal(), iState, and ipe::Attribute::NORMAL().

Referenced by ipe::Path::draw().

## cascade()

const Cascade * ipe::Painter::cascade | ( |  | ) | const

inline

Return style sheet cascade.

References iCascade.

Referenced by ipe::CairoPainter::doDrawPath(), doDrawSymbol(), ipe::PdfPainter::doDrawSymbol(), ipe::BBoxPainter::doDrawText(), ipe::Reference::draw(), ipe::Path::drawArrow(), and ipe::Reference::drawSimple().

## stroke()

Color ipe::Painter::stroke | ( |  | ) | const

inline

Return current stroke color.

References iState.

Referenced by ipe::CairoPainter::doDrawPath(), ipe::CairoPainter::doDrawText(), and ipe::Path::drawArrow().

## fill()

Color ipe::Painter::fill | ( |  | ) | const

inline

Return current fill color.

References iState.

Referenced by ipe::CairoPainter::doDrawPath().

## matrix()

const Matrix & ipe::Painter::matrix | ( |  | ) | const

inline

Return current transformation matrix.

References iMatrix.

Referenced by curveTo(), ipe::CairoPainter::doDrawArc(), ipe::PdfPainter::doDrawBitmap(), ipe::BBoxPainter::doDrawBitmap(), ipe::CairoPainter::doDrawBitmap(), ipe::PdfPainter::doDrawPath(), ipe::CairoPainter::doDrawPath(), ipe::PdfPainter::doDrawText(), ipe::BBoxPainter::doDrawText(), ipe::CairoPainter::doDrawText(), ipe::Group::draw(), ipe::Path::draw(), ipe::CairoPainter::executeStream(), lineTo(), moveTo(), pushMatrix(), transform(), translate(), and untransform().

## pen()

Fixed ipe::Painter::pen | ( |  | ) | const

inline

Return current pen.

References iState.

Referenced by ipe::BBoxPainter::doDrawPath(), ipe::CairoPainter::doDrawPath(), ipe::Path::drawArrow(), setPen(), and setSymPen().

## dashStyle() [1/2]

String ipe::Painter::dashStyle | ( |  | ) | const

inline

Return current dash style (always absolute attribute).

References iState.

Referenced by dashStyle(), and ipe::CairoPainter::doDrawPath().

## dashStyle() [2/2]

void Painter::dashStyle | ( | std::vector< double > & | dashes,
|  | double & | offset
| ) |  | const

Return dashstyle as a double sequence.

References dashStyle(), ipe::Lex::eos(), ipe::String::find(), ipe::Lex::getDouble(), and ipe::String::substr().

## lineCap()

TLineCap ipe::Painter::lineCap | ( |  | ) | const

inline

Return current line cap.

References iState.

Referenced by ipe::CairoPainter::doDrawPath().

## lineJoin()

TLineJoin ipe::Painter::lineJoin | ( |  | ) | const

inline

Return current line join.

References iState.

Referenced by ipe::CairoPainter::doDrawPath().

## fillRule()

TFillRule ipe::Painter::fillRule | ( |  | ) | const

inline

Return current fill rule.

References iState.

Referenced by ipe::PdfPainter::doDrawPath(), and ipe::CairoPainter::doDrawPath().

## symStroke()

Color ipe::Painter::symStroke | ( |  | ) | const

inline

Return current symbol stroke color.

References iState.

## symFill()

Color ipe::Painter::symFill | ( |  | ) | const

inline

Return current symbol fill color.

References iState.

## symPen()

Fixed ipe::Painter::symPen | ( |  | ) | const

inline

Return current symbol pen.

References iState.

## opacity()

Fixed ipe::Painter::opacity | ( |  | ) | const

inline

Return current opacity.

References iState.

Referenced by ipe::CairoPainter::doDrawBitmap(), ipe::CairoPainter::doDrawPath(), ipe::CairoPainter::doDrawText(), and ipe::CairoPainter::executeStream().

## strokeOpacity()

Fixed ipe::Painter::strokeOpacity | ( |  | ) | const

inline

Return current stroke opacity.

References iState.

Referenced by ipe::CairoPainter::doDrawPath().

## tiling()

Attribute ipe::Painter::tiling | ( |  | ) | const

inline

Return current tiling.

References iState.

Referenced by ipe::CairoPainter::doDrawPath(), and setTiling().

## gradient()

Attribute ipe::Painter::gradient | ( |  | ) | const

inline

Return current gradient fill.

References iState.

Referenced by ipe::CairoPainter::doDrawPath().

## state()

const State & ipe::Painter::state | ( |  | ) | const

inline

Return full current graphics state.

References iState.

Referenced by ipe::PdfPainter::doPush(), Painter(), ipe::PdfPainter::PdfPainter(), push(), and setState().

## setState()

void Painter::setState | ( | const State & | state | ) |

Set full graphics state at once.

References iState, and state().

## doPush()

void Painter::doPush | ( |  | ) |

protected virtual

Perform graphics state push on output medium.

Reimplemented in ipe::PdfPainter, ipe::BBoxPainter, and ipe::CairoPainter.

Referenced by push().

## doPop()

void Painter::doPop | ( |  | ) |

protected virtual

Perform graphics state pop on output medium.

Reimplemented in ipe::PdfPainter, ipe::BBoxPainter, and ipe::CairoPainter.

Referenced by pop().

## doNewPath()

void Painter::doNewPath | ( |  | ) |

protected virtual

Perform new path operator.

Reimplemented in ipe::PdfPainter, ipe::PsPainter, and ipe::BBoxPainter.

Referenced by newPath().

## doMoveTo()

void Painter::doMoveTo | ( | const Vector & | v | ) |

protected virtual

Perform moveto operator.

The transformation matrix has already been applied.

Reimplemented in ipe::PdfPainter, ipe::BBoxPainter, and ipe::CairoPainter.

Referenced by moveTo().

## doLineTo()

void Painter::doLineTo | ( | const Vector & | v | ) |

protected virtual

Perform lineto operator.

The transformation matrix has already been applied.

Reimplemented in ipe::PdfPainter, ipe::BBoxPainter, and ipe::CairoPainter.

Referenced by lineTo().

## doCurveTo()

void Painter::doCurveTo | ( | const Vector & | v1,
|  | const Vector & | v2,
|  | const Vector & | v3
| ) |  |

protected virtual

Perform curveto operator.

The transformation matrix has already been applied.

Reimplemented in ipe::PdfPainter, ipe::BBoxPainter, and ipe::CairoPainter.

Referenced by curveTo().

## doDrawArc()

void Painter::doDrawArc | ( | const Arc & | arc | ) |

protected virtual

Draw an elliptic arc.

The default implementations calls drawArcAsBezier(). The transformation matrix has not yet been applied to arc.

Reimplemented in ipe::CairoPainter.

References drawArcAsBezier(), ipe::Arc::iAlpha, ipe::Arc::iBeta, ipe::Arc::iM, ipe::Arc::isEllipse(), moveTo(), ipe::Angle::normalize(), popMatrix(), pushMatrix(), and transform().

Referenced by drawArc().

## doClosePath()

void Painter::doClosePath | ( |  | ) |

protected virtual

Perform closepath operator.

Reimplemented in ipe::PdfPainter, and ipe::CairoPainter.

Referenced by closePath().

## doDrawPath()

void Painter::doDrawPath | ( | TPathMode | mode | ) |

protected virtual

Actually draw the path.

Reimplemented in ipe::PdfPainter, ipe::PsPainter, ipe::BBoxPainter, and ipe::CairoPainter.

Referenced by drawPath().

## doDrawBitmap()

void Painter::doDrawBitmap | ( | Bitmap | bitmap | ) |

protected virtual

Draw a bitmap.

Reimplemented in ipe::PdfPainter, ipe::PsPainter, ipe::BBoxPainter, and ipe::CairoPainter.

Referenced by drawBitmap().

## doDrawText()

void Painter::doDrawText | ( | const Text * | text | ) |

protected virtual

Draw a text object.

Reimplemented in ipe::PdfPainter, ipe::BBoxPainter, and ipe::CairoPainter.

Referenced by drawText().

## doDrawSymbol()

void Painter::doDrawSymbol | ( | Attribute | symbol | ) |

protected virtual

Draw a symbol.

The default implementation calls the draw method of the object. Only PDF drawing overrides this to reuse a PDF XForm.

Reimplemented in ipe::PdfPainter.

References cascade(), ipe::Object::draw(), ipe::ESymbol, ipe::Cascade::findSymbol(), iAttributeMap, ipe::Symbol::iObject, and ipe::AttributeMap::map().

Referenced by drawSymbol().

## doAddClipPath()

void Painter::doAddClipPath | ( |  | ) |

protected virtual

Add a clip path.

Reimplemented in ipe::PdfPainter, ipe::PsPainter, ipe::BBoxPainter, and ipe::CairoPainter.

Referenced by addClipPath().

## drawArcAsBezier()

void Painter::drawArcAsBezier | ( | double | alpha | ) |

protected

Draw an arc of the unit circle of length alpha.

PDF does not have an "arc" or "circle" primitive, so to draw an arc, circle, or ellipse, Ipe has to translate it into a sequence of Bezier curves.

The approximation is based on the following: The unit circle arc from (1,0) to (cos a, sin a) be approximated by a Bezier spline with control points (1, 0), (1, beta) and their mirror images along the line with slope a/2, where beta = 4.0 * (1.0 - cos(a/2)) / (3 * sin(a/2))

Ipe draws circles by drawing four Bezier curves for the quadrants, and arcs by patching together quarter circle approximations with a piece computed from the formula above.

alpha is normalized to [0, 2 pi], and applied starting from the point (1,0).

The function generates a sequence of Bezier splines as calls to curveTo. It is assumed that the caller has already executed a moveTo to the beginning of the arc at (1,0).

This function may modify the transformation matrix.

References curveTo().

Referenced by doDrawArc().

## Member Data Documentation

## iState

std::list<State> ipe::Painter::iState

protected

Referenced by dashStyle(), ipe::PdfPainter::doDrawPath(), ipe::PdfPainter::drawAttributes(), ipe::PdfPainter::drawOpacity(), fill(), fillRule(), gradient(), lineCap(), lineJoin(), newPath(), opacity(), Painter(), pen(), pop(), push(), setDashStyle(), setFill(), setFillRule(), setGradient(), setLineCap(), setLineJoin(), setOpacity(), setPen(), setState(), setStroke(), setStrokeOpacity(), setSymFill(), setSymPen(), setSymStroke(), setTiling(), state(), stroke(), strokeOpacity(), symFill(), symPen(), symStroke(), and tiling().

## iMatrix

std::list<Matrix> ipe::Painter::iMatrix

protected

Referenced by matrix(), Painter(), popMatrix(), pushMatrix(), transform(), translate(), and untransform().

## iCascade

const Cascade* ipe::Painter::iCascade

protected

Referenced by cascade(), ipe::PdfPainter::doDrawPath(), lookup(), and Painter().

## iAttributeMap

const AttributeMap* ipe::Painter::iAttributeMap

protected

Referenced by doDrawSymbol(), lookup(), Painter(), and setAttributeMap().

## iInPath

int ipe::Painter::iInPath

protected

Referenced by addClipPath(), closePath(), curveTo(), drawArc(), drawBitmap(), drawPath(), drawSymbol(), drawText(), lineTo(), moveTo(), newPath(), Painter(), pop(), push(), setDashStyle(), setFill(), setFillRule(), setGradient(), setLineCap(), setLineJoin(), setOpacity(), setPen(), setStroke(), setStrokeOpacity(), setSymFill(), setSymPen(), setSymStroke(), and setTiling().

The documentation for this class was generated from the following files:

- ipepainter.h
- ipepainter.cpp