Ipelib: ipe::Painter Class Reference

Ipelib

- Main Page
- Related Pages
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ipe::Painter Class Reference
Ipe Base

`#include <ipepainter.h>`

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

## Classes
struct | State

## Public Member Functions
| Painter (const Cascade *style)
virtual | ~Painter ()
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 | 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
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
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 | ( | 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(), 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::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 | ( |  | ) |
| virtual

Virtual destructor.

## Member Function Documentation

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::Image::draw(), ipe::Text::draw(), ipe::Reference::draw(), ipe::Group::draw(), ipe::Path::draw(), ipe::TransformTool::draw(), ipe::Path::drawArrow(), Canvas::drawRect(), ipe::Image::drawSimple(), ipe::Text::drawSimple(), ipe::Reference::drawSimple(), ipe::Group::drawSimple(), and ipe::Path::drawSimple().

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, matrix(), and ipe::Matrix::translation().

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

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::PanTool::draw(), ipe::Text::draw(), ipe::Reference::draw(), ipe::Path::drawArrow(), ipe::Text::drawSimple(), and ipe::Reference::drawSimple().

void Painter::push | ( |  | ) |

Save current graphics state.

Cannot be called in path construction mode.

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

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

void Painter::pop | ( |  | ) |

Restore previous graphics state.

Cannot be called in path construction mode.

References doPop(), iInPath, and iState.

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

void Painter::pushMatrix | ( |  | ) |

Save current transformation matrix.

References iMatrix, and matrix().

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

void Painter::popMatrix | ( |  | ) |

Restore previous transformation matrix.

References iMatrix.

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

void Painter::newPath | ( |  | ) |

Enter path construction mode.

References doNewPath(), iInPath, and iState.

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

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::Text::drawSimple(), ipe::Reference::drawSimple(), and rect().

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::Text::drawSimple(), ipe::Reference::drawSimple(), and rect().

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().

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

Overloaded function.

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

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

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().

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

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::SelectTool::draw(), ipe::CurveSegment::draw(), ipe::Ellipse::draw(), and ipe::Path::drawArrow().

void Painter::closePath | ( |  | ) |

Close the current subpath.

References doClosePath(), and iInPath.

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

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::Image::drawSimple(), ipe::Text::drawSimple(), ipe::Reference::drawSimple(), and ipe::Path::drawSimple().

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().

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().

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().

void Painter::addClipPath | ( |  | ) |

Add current path as clip path.

References doAddClipPath(), and iInPath.

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

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

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

References ipe::Attribute::color(), ipe::EColor, ipe::Cascade::find(), iCascade, iInPath, iState, ipe::Attribute::SYM_FILL(), and ipe::Attribute::SYM_STROKE().

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

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

Set fill color, resolving symbolic color.

References ipe::Attribute::color(), ipe::EColor, ipe::Cascade::find(), iCascade, iInPath, iState, ipe::Attribute::SYM_FILL(), and ipe::Attribute::SYM_STROKE().

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

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

Set pen, resolving symbolic value.

References ipe::EPen, ipe::Cascade::find(), iCascade, iInPath, iState, ipe::Attribute::number(), and ipe::Attribute::SYM_PEN().

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

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

Set dash style, resolving symbolic value.

References ipe::EDashStyle, ipe::Cascade::find(), iCascade, iInPath, iState, and ipe::Attribute::string().

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

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().

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().

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().

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

Set symbol stroke color, resolving symbolic color.

References ipe::Attribute::color(), ipe::EColor, ipe::Cascade::find(), iCascade, iInPath, iState, ipe::Attribute::SYM_FILL(), and ipe::Attribute::SYM_STROKE().

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

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

Set symbol fill color, resolving symbolic color.

References ipe::Attribute::color(), ipe::EColor, ipe::Cascade::find(), iCascade, iInPath, iState, ipe::Attribute::SYM_FILL(), and ipe::Attribute::SYM_STROKE().

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

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

Set symbol pen, resolving symbolic pen.

References ipe::EPen, ipe::Cascade::find(), iCascade, iInPath, iState, ipe::Attribute::number(), and ipe::Attribute::SYM_PEN().

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

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

Set opacity.

References ipe::EOpacity, ipe::Cascade::find(), iCascade, iInPath, iState, and ipe::Attribute::number().

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

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().

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().

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

Return style sheet cascade.

References iCascade.

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

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

Return current stroke color.

References iState.

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

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

Return current fill color.

References iState.

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

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::CairoPainter::doDrawText(), ipe::BBoxPainter::doDrawText(), ipe::Group::draw(), ipe::Path::draw(), lineTo(), moveTo(), pushMatrix(), transform(), translate(), and untransform().

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

Return current pen.

References iState.

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

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

Return current dash style (always absolute attribute).

References iState.

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

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

Return dashstyle as a double sequence.

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

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

Return current line cap.

References iState.

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

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

Return current line join.

References iState.

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

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

Return current fill rule.

References iState.

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

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

Return current symbol stroke color.

References iState.

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

Return current symbol fill color.

References iState.

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

Return current symbol pen.

References iState.

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

Return current opacity.

References iState.

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

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

Return current tiling.

References iState.

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

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

Return current gradient fill.

References iState.

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

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

Return full current graphics state.

References doAddClipPath(), doClosePath(), doCurveTo(), doDrawArc(), doDrawBitmap(), doDrawPath(), doDrawSymbol(), doDrawText(), doLineTo(), doMoveTo(), doNewPath(), doPop(), doPush(), drawArcAsBezier(), iState, and setState().

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

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

Set full graphics state at once.

References iState, and state().

Referenced by state().

void Painter::doPush | ( |  | ) |
| protectedvirtual

Perform graphics state push on output medium.

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

Referenced by push(), and state().

void Painter::doPop | ( |  | ) |
| protectedvirtual

Perform graphics state pop on output medium.

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

Referenced by pop(), and state().

void Painter::doNewPath | ( |  | ) |
| protectedvirtual

Perform new path operator.

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

Referenced by newPath(), and state().

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

Perform moveto operator.

The transformation matrix has already been applied.

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

Referenced by moveTo(), and state().

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

Perform lineto operator.

The transformation matrix has already been applied.

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

Referenced by lineTo(), and state().

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

Perform curveto operator.

The transformation matrix has already been applied.

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

Referenced by curveTo(), and state().

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

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(), and state().

void Painter::doClosePath | ( |  | ) |
| protectedvirtual

Perform closepath operator.

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

Referenced by closePath(), and state().

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

Actually draw the path.

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

Referenced by drawPath(), and state().

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

Draw a bitmap.

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

Referenced by drawBitmap(), and state().

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

Draw a text object.

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

Referenced by drawText(), and state().

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

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::Cascade::findSymbol(), and ipe::Symbol::iObject.

Referenced by drawSymbol(), and state().

void Painter::doAddClipPath | ( |  | ) |
| protectedvirtual

Add a clip path.

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

Referenced by addClipPath(), and state().

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(), and state().

## Member Data Documentation

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(), setSymFill(), setSymPen(), setSymStroke(), setTiling(), state(), stroke(), symFill(), symPen(), symStroke(), and tiling().

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

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

const Cascade* ipe::Painter::iCascade
| protected

Referenced by cascade(), ipe::PdfPainter::doDrawPath(), Painter(), setDashStyle(), setFill(), setOpacity(), setPen(), setStroke(), setSymFill(), setSymPen(), and setSymStroke().

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(), setSymFill(), setSymPen(), setSymStroke(), and setTiling().

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

- ipepainter.h
- ipepainter.cpp