Chemical Data Processing Library C++ API - Version 1.1.1
|
An interface that provides methods for low level 2D drawing operations. More...
#include <Renderer2D.hpp>
Public Member Functions | |
virtual | ~Renderer2D () |
Virtual destructor. More... | |
virtual void | saveState ()=0 |
Saves the current renderer state. More... | |
virtual void | restoreState ()=0 |
Restores the last renderer state saved by a call to saveState(). More... | |
virtual void | setTransform (const Math::Matrix3D &xform)=0 |
Sets the applied affine transformation matrix to xform. More... | |
virtual void | transform (const Math::Matrix3D &xform)=0 |
Multiplies the current affine transformation matrix by xform. More... | |
virtual void | setPen (const Pen &pen)=0 |
Sets the pen to be used in subsequent drawing operations. More... | |
virtual void | setBrush (const Brush &brush)=0 |
Sets the brush to be used in subsequent drawing operations. More... | |
virtual void | setFont (const Font &font)=0 |
Sets the font to be used in subsequent text drawing operations. More... | |
virtual void | drawRectangle (double x, double y, double width, double height)=0 |
Draws an axis aligned rectangle of the specified width and height whose upper-left corner is located at (x, y). More... | |
virtual void | drawPolygon (const Math::Vector2DArray &points)=0 |
Draws the polygon defined by points. More... | |
virtual void | drawLine (double x1, double y1, double x2, double y2)=0 |
Draws a line segment from (x1, y1) to (x2, y2). More... | |
virtual void | drawPolyline (const Math::Vector2DArray &points)=0 |
Draws the polyline defined by points. More... | |
virtual void | drawLineSegments (const Math::Vector2DArray &points)=0 |
Draws the sequence of disjoint line segments defined by points. More... | |
virtual void | drawPoint (double x, double y)=0 |
Draws a point at the position (x, y). More... | |
virtual void | drawEllipse (double x, double y, double width, double height)=0 |
Draws an ellipse with the given width and height around the center position (x, y). More... | |
virtual void | drawPath (const Path2D &path)=0 |
Draws the given path. More... | |
virtual void | drawText (double x, double y, const std::string &txt)=0 |
Draws the specified text at the position (x, y). More... | |
virtual void | setClipPath (const Path2D &path)=0 |
virtual void | clearClipPath ()=0 |
Disables clipping. More... | |
An interface that provides methods for low level 2D drawing operations.
For the drawing of graphical primitives the following methods are provided:
Drawing operations can be clipped to arbitrary shapes defined by a Vis::Path2D object. A new clip region is set by calling the method setClipPath() and disabled by calling clearClipPath().
Coordinates of points that define the geometry of graphical primitives are normally directly mapped to the coordinate system of the drawing device (e.g. an off-screen image buffer). This 1:1 mapping can be changed by applying affine transformations to the input coordinates.
Affine coordinate transformations can be specified by calling the methods:
The former method replaces the current transformation matrix by a matrix that was provided as argument. When the latter method is called, the current matrix gets multiplied with the argument matrix to produce a combined affine transformation. To restore the 1:1 coordinate mapping, call setTransform() with a default constructed Math::AffineTransform3D instance.
The style and color of lines and shape outlines is defined by the current pen which is specified by setPen(). The current pen also defines the color of rendered text and the color and diameter of points. The fill pattern and fill color of shapes (rectangles and polygons) is defined by the current brush which is specified by setBrush().
The current state of the renderer (brush, pen, font and transformation matrix) may be saved by saveState() and restored by restoreState().
|
inlinevirtual |
Virtual destructor.
|
pure virtual |
Saves the current renderer state.
The method saves the current pen, brush, font and transformation matrix on an internal stack. The last saved state can be restored later on by a call to restoreState().
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Restores the last renderer state saved by a call to saveState().
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Sets the applied affine transformation matrix to xform.
xform | The new affine transformation matrix. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Multiplies the current affine transformation matrix by xform.
xform | The matrix by which the current affine transformation matrix is multiplied. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Sets the pen to be used in subsequent drawing operations.
pen | The new pen for subsequent drawing operations. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Sets the brush to be used in subsequent drawing operations.
brush | The new brush for subsequent drawing operations. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Sets the font to be used in subsequent text drawing operations.
font | The new font used in subsequent text drawing operations. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Draws an axis aligned rectangle of the specified width and height whose upper-left corner is located at (x, y).
The rectangle is filled as specified by the current brush and the outline will be drawn as specified by the current pen.
x | The x-coordinate of the upper-left corner. |
y | The y-coordinate of the upper-left corner. |
width | The width of the rectangle. |
height | The height of the rectangle. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Draws the polygon defined by points.
For a given set of \( N \) corner points \( p_i \) with \( i = 1, 2, \ldots, N \), the polygon's \( N \) edges are given by \( (p_1, p_2), (p_2, p_3), \ldots, (p_N, p_0) \). The polygon is filled as specified by the current brush and the outline will be drawn as specified by the current pen.
points | An array of points specifying the corners of the polygon. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Draws a line segment from (x1, y1) to (x2, y2).
The line style, color, cap style and line width is specified by the current pen.
x1 | The x-coordinate of the starting point. |
y1 | The y-coordinate of the starting point. |
x2 | The x-coordinate of the end point. |
y2 | The y-coordinate of the end point. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Draws the polyline defined by points.
For a given set of \( N \) points \( p_i \) with \( i = 1, 2, \ldots, N \), \( N - 1 \) connected line segments \( (p_1, p_2), (p_2, p_3), \ldots, (p_{N - 1}, p_N) \) will be drawn. The line style, color, cap style, join style and line width is specified by the current pen.
points | An array of points defining the polyline. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Draws the sequence of disjoint line segments defined by points.
For a given set of \( 2N \) points \( p_i \) with \( i = 1, 2, \ldots, 2N \), \( N \) disjoint line segments \( (p_1, p_2), (p_3, p_4), \ldots, (p_{2N - 1}, p_2N) \) will be drawn. The line style, color, cap style and line width is specified by the current pen.
points | An array of points defining the line segments. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
Draws a point at the position (x, y).
The diameter and color of the point is specified by the current pen.
x | The x-coordinate of the point. |
y | The y-coordinate of the point. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Draws an ellipse with the given width and height around the center position (x, y).
The ellipse is filled as specified by the current brush and the outline will be drawn as specified by the current pen.
x | The x-coordinate of the center point. |
y | The y-coordinate of the center point. |
width | The width of the ellipse. |
height | The height of the ellipse. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Draws the given path.
The path is filled as specified by the current brush and the outline will be drawn as specified by the current pen.
path | The path to draw. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Draws the specified text at the position (x, y).
The text color is specified by the current pen. The font has to be specified by setFont().
x | The x-position of the drawn text. |
y | The y-position of the baseline. |
txt | The text to draw. |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.
|
pure virtual |
Disables clipping.
Implemented in CDPL::Vis::QtRenderer2D, and CDPL::Vis::CairoRenderer2D.