Chemical Data Processing Library C++ API - Version 1.0.0
Renderer2D.hpp
Go to the documentation of this file.
1 /*
2  * Renderer2D.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_VIS_RENDERER2D_HPP
30 #define CDPL_VIS_RENDERER2D_HPP
31 
32 #include <string>
33 
34 #include "CDPL/Vis/APIPrefix.hpp"
36 #include "CDPL/Math/Matrix.hpp"
37 
38 
39 namespace CDPL
40 {
41 
42  namespace Vis
43  {
44 
45  class Pen;
46  class Brush;
47  class Font;
48 
81  {
82 
83  public:
87  virtual ~Renderer2D() {}
88 
97  virtual void saveState() = 0;
98 
103  virtual void restoreState() = 0;
104 
109  virtual void setTransform(const Math::Matrix3D& xform) = 0;
110 
115  virtual void transform(const Math::Matrix3D& xform) = 0;
116 
122  virtual void setPen(const Pen& pen) = 0;
123 
129  virtual void setBrush(const Brush& brush) = 0;
130 
136  virtual void setFont(const Font& font) = 0;
137 
151  virtual void drawRectangle(double x, double y, double width, double height) = 0;
152 
163  virtual void drawPolygon(const Math::Vector2DArray& points) = 0;
164 
176  virtual void drawLine(double x1, double y1, double x2, double y2) = 0;
177 
188  virtual void drawPolyline(const Math::Vector2DArray& points) = 0;
189 
200  virtual void drawLineSegments(const Math::Vector2DArray& points) = 0;
201 
211  virtual void drawPoint(double x, double y) = 0;
212 
225  virtual void drawEllipse(double x, double y, double width, double height) = 0;
226 
238  virtual void drawText(double x, double y, const std::string& txt) = 0;
239  };
240  } // namespace Vis
241 } // namespace CDPL
242 
243 #endif // CDPL_VIS_RENDERER2D_HPP
CDPL::Vis::Renderer2D::drawEllipse
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).
CDPL::Vis::Renderer2D::drawRectangle
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 ...
CDPL::Vis::Renderer2D
An interface that provides methods for low level 2D drawing operations.
Definition: Renderer2D.hpp:81
VectorArray.hpp
Definition of the class CDPL::Math::VectorArray.
CDPL::Vis::Renderer2D::setBrush
virtual void setBrush(const Brush &brush)=0
Sets the brush to be used in subsequent drawing operations.
CDPL::Vis::Renderer2D::setPen
virtual void setPen(const Pen &pen)=0
Sets the pen to be used in subsequent drawing operations.
CDPL::Vis::Pen
Specifies how to draw lines and outlines of shapes.
Definition: Pen.hpp:53
CDPL::Vis::Renderer2D::drawPolyline
virtual void drawPolyline(const Math::Vector2DArray &points)=0
Draws the polyline defined by points.
CDPL::Vis::Renderer2D::saveState
virtual void saveState()=0
Saves the current renderer state.
CDPL::Vis::Renderer2D::restoreState
virtual void restoreState()=0
Restores the last renderer state saved by a call to saveState().
CDPL::Vis::Renderer2D::drawText
virtual void drawText(double x, double y, const std::string &txt)=0
Draws the specified text at the position (x, y).
CDPL::Vis::Font
Specifies a font for drawing text.
Definition: Font.hpp:54
CDPL::Vis::Renderer2D::drawLine
virtual void drawLine(double x1, double y1, double x2, double y2)=0
Draws a line segment from (x1, y1) to (x2, y2).
CDPL::Vis::Renderer2D::drawPolygon
virtual void drawPolygon(const Math::Vector2DArray &points)=0
Draws the polygon defined by points.
CDPL::Vis::Renderer2D::transform
virtual void transform(const Math::Matrix3D &xform)=0
Multiplies the current affine transformation matrix by xform.
CDPL::Vis::Renderer2D::setTransform
virtual void setTransform(const Math::Matrix3D &xform)=0
Sets the applied affine transformation matrix to xform.
CDPL_VIS_API
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Vis::Renderer2D::~Renderer2D
virtual ~Renderer2D()
Virtual destructor.
Definition: Renderer2D.hpp:87
CDPL::Math::Matrix3D
CMatrix< double, 3, 3 > Matrix3D
A bounded 3x3 matrix holding floating point values of type double.
Definition: Matrix.hpp:1849
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Vis::Renderer2D::setFont
virtual void setFont(const Font &font)=0
Sets the font to be used in subsequent text drawing operations.
CDPL::Vis::Renderer2D::drawPoint
virtual void drawPoint(double x, double y)=0
Draws a point at the position (x, y).
CDPL::Vis::Brush
Specifies the fill pattern and fill color of shapes.
Definition: Brush.hpp:50
CDPL::Vis::Renderer2D::drawLineSegments
virtual void drawLineSegments(const Math::Vector2DArray &points)=0
Draws the sequence of disjoint line segments defined by points.
Matrix.hpp
Definition of matrix data types.
CDPL::Math::Vector2DArray
VectorArray< Vector2D > Vector2DArray
An array of Math::Vector2D objects.
Definition: VectorArray.hpp:79
APIPrefix.hpp
Definition of the preprocessor macro CDPL_VIS_API.