Inherited by IpeBBoxPainter, and IpePdfPainter.
IpePainter-derived classes are used for drawing to the screen and for generating PDF and Postscript output.
The IpePainter maintains a stack of graphics states, which includes stroke and fill color, line width, dash style, miter limit, line cap and line join, and the current transformation matrix. The IpePainter class takes care of maintaining this stack, and setting of the attributes in the current graphics state.
Setting an attribute with a symbolic value is resolved immediately using the IpeStyleSheet attached to the IpePainter, so calling the Stroke() or Fill() methods of IpePainter 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 (normal, black, solid, etc.).
A null fill color is drawn as if it was void. Ipe objects exploit this: only group objects ever need to explicitly contain a 'void' fill color.
A null stroke color means not to draw any outline on paths. This is only meant to support old Ipe files (before 6.0 pre 25).
The correct way to draw filled objects without boundary is to set the line style to 'void'.
A null dash style is drawn as solid.
A null line width is drawn as whatever is the standard of the drawing medium (that is, as line width 0).
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, DrawEllipse, ClosePath), the transformation operators (Transform, Untransform, Translate), and the stack operators (Push, Pop) are admissible. (Pushs and pops must balance inside path construction. Note that pushs and pops inside path construction only affect the current (painter-internal) tranformation matrix, they do not generate Postscript gsave/grestore operators.) The path is drawn using DrawPath, this ends path construction mode. Path construction operators cannot be used in general mode.
Derived classes need to implement the DoXXX functions for drawing paths, images, and texts.
|
Constructor takes a (cascaded) style sheet, which is not owned. The initial graphics state contains all null attributes. |
|
Virtual destructor.
|
|
Concatenate a matrix to current transformation matrix.
|
|
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. If direct is |
|
Concatenate a translation to current transformation matrix.
|
|
Save current graphics state.
|
|
Restore previous graphics state.
|
|
Enter path construction mode.
|
|
Start a new subpath.
|
|
Add line segment to current subpath.
|
|
Add a Bezier segment to current subpath.
|
|
Overloaded function.
Assumes current position is |
|
Add a rectangle subpath to the path. Has a default implementation in terms of MoveTo and LineTo, but derived classes can reimplement for efficiency. |
|
Draw the unit circle. 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. This does not modify the transformation matrix. The path is generated as a sequence MoveTo .. CurveTo .. ClosePath operators, but is not actually drawn (DrawPath is not called). |
|
Draw an arc of the unit circle of length alpha. alpha is normalized to [0, 2 pi], and applied starting from the point (1,0). The function works by generating a sequence of Bezier splines (see DrawEllipse for details of the transformation). It only generates 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. |
|
Close the current subpath.
|
|
Fill and/or stroke a path (depending on color). As in PDF, an "path" can consist of several subpaths. |
|
Render a bitmap. Assumes the transformation matrix has been set up to map the unit square to the image area on the paper. |
|
Render a text object. Stroke color is already set, and the origin is the lower-left corner of the text box. |
|
Set stroke color, resolving symbolic color.
|
|
Set fill color, resolving symbolic color. A null fill color will ultimately be rendered as void. |
|
Set line width, resolving symbolic value.
|
|
Set dash style, resolving symbolic value.
|
|
Set line cap.
|
|
Set line join.
|
|
Set wind rule (wind or even-odd).
|
|
Set font size of text objects. Paradoxically, this isn't actually used to render text, but for saving Ipegroup objects! Text goes through the IpeLatex interface, and the visitor that scans for text objects and writes them to the Latex source file finds the text size information itself. |
|
Set size of mark objects.
|
|
Set shape of mark objects.
|
|
Return style sheet.
|
|
Return current stroke color (always absolute).
|
|
Return current fill color (always absolute).
|
|
Return current transformation matrix.
|
|
Return current line width (always absolute).
|
|
Return current dash style (always absolute).
|
|
Return current line cap.
|
|
Return current line join.
|
|
Return current wind rule.
|
|
Return current text font size.
|
|
Return current mark size.
|
|
Return current mark shape.
|
|
Return repository.
|
|
Perform push on output medium (if necessary). This is not called when client uses Push during path construction! |
|
Perform pop on output medium (if necessary). This is not called when client uses Pop during path construction! |
|
Perform new path operator.
|
|
Perform moveto operator.
Reimplemented in IpeBBoxPainter. |
|
Perform lineto operator.
Reimplemented in IpeBBoxPainter. |
|
Perform curveto operator.
Reimplemented in IpeBBoxPainter. |
|
Perform closepath operator.
|
|
Actually draw the path.
|
|
Draw a bitmap.
Reimplemented in IpeBBoxPainter. |
|
Draw a text object.
Reimplemented in IpeBBoxPainter. |