Chemical Data Processing Library C++ API - Version 1.4.0
Public Member Functions | List of all members
CDPL::Vis::QtRenderer2D Class Reference

Implements the Renderer2D interface on top of the Qt Toolkit. More...

#include <QtRenderer2D.hpp>

+ Inheritance diagram for CDPL::Vis::QtRenderer2D:

Public Member Functions

 QtRenderer2D (QPainter &painter)
 Constructs a renderer object which uses the QPainter instance painter for its drawing operations. More...
 
 QtRenderer2D (const QtRenderer2D &)=delete
 
 ~QtRenderer2D ()
 Destructor. More...
 
QtRenderer2Doperator= (const QtRenderer2D &)=delete
 
void saveState ()
 Pushes the current pen, brush, font, transformation and clip path onto an internal state stack. More...
 
void restoreState ()
 Pops the topmost stack entry and restores the renderer to the saved state. More...
 
void setTransform (const Math::Matrix3D &xform)
 Replaces the current transformation matrix by xform. More...
 
void transform (const Math::Matrix3D &xform)
 Right-multiplies the current transformation matrix by xform. More...
 
void setPen (const Pen &pen)
 Sets the pen used for drawing outlines and lines. More...
 
void setBrush (const Brush &brush)
 Sets the brush used for filling shapes. More...
 
void setFont (const Font &font)
 Sets the font used for rendering text. More...
 
void drawRectangle (double x1, double y1, double x2, double y2)
 Draws an axis-aligned rectangle from (x1, y1) to (x2, y2). More...
 
void drawPolygon (const Math::Vector2DArray &points)
 Draws the (filled) polygon defined by the vertex sequence points. More...
 
void drawLine (double x1, double y1, double x2, double y2)
 Draws a single line segment from (x1, y1) to (x2, y2). More...
 
void drawPolyline (const Math::Vector2DArray &points)
 Draws the open polyline defined by the vertex sequence points. More...
 
void drawLineSegments (const Math::Vector2DArray &points)
 Draws the disjoint line segments defined by consecutive vertex pairs in points. More...
 
void drawPoint (double x, double y)
 Draws a single point at (x, y). More...
 
void drawText (double x, double y, const std::string &txt)
 Draws the text txt with its baseline starting at (x, y). More...
 
void drawEllipse (double x, double y, double width, double height)
 Draws an axis-aligned ellipse centered at (x, y) with the given width and height. More...
 
void drawPath (const Path2D &path)
 Draws (strokes and fills) the 2D path path. More...
 
void setClipPath (const Path2D &path)
 Sets the renderer's active clipping region to path. More...
 
void clearClipPath ()
 Disables any currently active clipping region. More...
 
- Public Member Functions inherited from CDPL::Vis::Renderer2D
virtual ~Renderer2D ()
 Virtual destructor. More...
 

Detailed Description

Implements the Renderer2D interface on top of the Qt Toolkit.

QtRenderer2D is implemented by forwarding the drawing operations to a provided QPainter instance which has been created for the desired output device (screen, printer, off-screen image, ...). For more information about QPainter and the Qt Toolkit see [QTDOC].

Constructor & Destructor Documentation

◆ QtRenderer2D() [1/2]

CDPL::Vis::QtRenderer2D::QtRenderer2D ( QPainter &  painter)

Constructs a renderer object which uses the QPainter instance painter for its drawing operations.

Parameters
painterThe wrapped QPainter instance.

◆ QtRenderer2D() [2/2]

CDPL::Vis::QtRenderer2D::QtRenderer2D ( const QtRenderer2D )
delete

◆ ~QtRenderer2D()

CDPL::Vis::QtRenderer2D::~QtRenderer2D ( )

Destructor.

Member Function Documentation

◆ operator=()

QtRenderer2D& CDPL::Vis::QtRenderer2D::operator= ( const QtRenderer2D )
delete

◆ saveState()

void CDPL::Vis::QtRenderer2D::saveState ( )
virtual

Pushes the current pen, brush, font, transformation and clip path onto an internal state stack.

Implements CDPL::Vis::Renderer2D.

◆ restoreState()

void CDPL::Vis::QtRenderer2D::restoreState ( )
virtual

Pops the topmost stack entry and restores the renderer to the saved state.

Implements CDPL::Vis::Renderer2D.

◆ setTransform()

void CDPL::Vis::QtRenderer2D::setTransform ( const Math::Matrix3D xform)
virtual

Replaces the current transformation matrix by xform.

Parameters
xformThe new transformation matrix.

Implements CDPL::Vis::Renderer2D.

◆ transform()

void CDPL::Vis::QtRenderer2D::transform ( const Math::Matrix3D xform)
virtual

Right-multiplies the current transformation matrix by xform.

Parameters
xformThe transformation matrix to append.

Implements CDPL::Vis::Renderer2D.

◆ setPen()

void CDPL::Vis::QtRenderer2D::setPen ( const Pen pen)
virtual

Sets the pen used for drawing outlines and lines.

Parameters
penThe new pen.

Implements CDPL::Vis::Renderer2D.

◆ setBrush()

void CDPL::Vis::QtRenderer2D::setBrush ( const Brush brush)
virtual

Sets the brush used for filling shapes.

Parameters
brushThe new brush.

Implements CDPL::Vis::Renderer2D.

◆ setFont()

void CDPL::Vis::QtRenderer2D::setFont ( const Font font)
virtual

Sets the font used for rendering text.

Parameters
fontThe new font.

Implements CDPL::Vis::Renderer2D.

◆ drawRectangle()

void CDPL::Vis::QtRenderer2D::drawRectangle ( double  x1,
double  y1,
double  x2,
double  y2 
)
virtual

Draws an axis-aligned rectangle from (x1, y1) to (x2, y2).

Parameters
x1The x-coordinate of the first corner.
y1The y-coordinate of the first corner.
x2The x-coordinate of the opposing corner.
y2The y-coordinate of the opposing corner.

Implements CDPL::Vis::Renderer2D.

◆ drawPolygon()

void CDPL::Vis::QtRenderer2D::drawPolygon ( const Math::Vector2DArray points)
virtual

Draws the (filled) polygon defined by the vertex sequence points.

Parameters
pointsThe polygon's vertex sequence.

Implements CDPL::Vis::Renderer2D.

◆ drawLine()

void CDPL::Vis::QtRenderer2D::drawLine ( double  x1,
double  y1,
double  x2,
double  y2 
)
virtual

Draws a single line segment from (x1, y1) to (x2, y2).

Parameters
x1The x-coordinate of the line's start point.
y1The y-coordinate of the line's start point.
x2The x-coordinate of the line's end point.
y2The y-coordinate of the line's end point.

Implements CDPL::Vis::Renderer2D.

◆ drawPolyline()

void CDPL::Vis::QtRenderer2D::drawPolyline ( const Math::Vector2DArray points)
virtual

Draws the open polyline defined by the vertex sequence points.

Parameters
pointsThe polyline's vertex sequence.

Implements CDPL::Vis::Renderer2D.

◆ drawLineSegments()

void CDPL::Vis::QtRenderer2D::drawLineSegments ( const Math::Vector2DArray points)
virtual

Draws the disjoint line segments defined by consecutive vertex pairs in points.

Parameters
pointsThe vertex sequence (size must be even).

Implements CDPL::Vis::Renderer2D.

◆ drawPoint()

void CDPL::Vis::QtRenderer2D::drawPoint ( double  x,
double  y 
)
virtual

Draws a single point at (x, y).

Parameters
xThe point's x-coordinate.
yThe point's y-coordinate.

Implements CDPL::Vis::Renderer2D.

◆ drawText()

void CDPL::Vis::QtRenderer2D::drawText ( double  x,
double  y,
const std::string &  txt 
)
virtual

Draws the text txt with its baseline starting at (x, y).

Parameters
xThe baseline x-coordinate.
yThe baseline y-coordinate.
txtThe text to draw.

Implements CDPL::Vis::Renderer2D.

◆ drawEllipse()

void CDPL::Vis::QtRenderer2D::drawEllipse ( double  x,
double  y,
double  width,
double  height 
)
virtual

Draws an axis-aligned ellipse centered at (x, y) with the given width and height.

Parameters
xThe x-coordinate of the ellipse's center.
yThe y-coordinate of the ellipse's center.
widthThe width of the ellipse.
heightThe height of the ellipse.

Implements CDPL::Vis::Renderer2D.

◆ drawPath()

void CDPL::Vis::QtRenderer2D::drawPath ( const Path2D path)
virtual

Draws (strokes and fills) the 2D path path.

Parameters
pathThe path to draw.

Implements CDPL::Vis::Renderer2D.

◆ setClipPath()

void CDPL::Vis::QtRenderer2D::setClipPath ( const Path2D path)
virtual

Sets the renderer's active clipping region to path.

Parameters
pathThe path defining the new clipping region.

Implements CDPL::Vis::Renderer2D.

◆ clearClipPath()

void CDPL::Vis::QtRenderer2D::clearClipPath ( )
virtual

Disables any currently active clipping region.

Implements CDPL::Vis::Renderer2D.


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