Chemical Data Processing Library C++ API - Version 1.1.1
Pen.hpp
Go to the documentation of this file.
1 /*
2  * Pen.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_PEN_HPP
30 #define CDPL_VIS_PEN_HPP
31 
32 #include "CDPL/Vis/APIPrefix.hpp"
33 #include "CDPL/Vis/Color.hpp"
34 
35 
36 namespace CDPL
37 {
38 
39  namespace Vis
40  {
41 
53  {
54 
55  public:
59  enum LineStyle
60  {
61 
66 
71 
76 
81 
86 
90  DASH_DOT_DOT_LINE
91  };
92 
96  enum CapStyle
97  {
98 
103 
108 
112  ROUND_CAP
113  };
114 
119  {
120 
125 
130 
134  ROUND_JOIN
135  };
136 
141  Pen();
142 
148  Pen(LineStyle line_style);
149 
161  Pen(const Color& color, double width = 1.0, LineStyle line_style = SOLID_LINE,
162  CapStyle cap_style = ROUND_CAP, JoinStyle join_style = ROUND_JOIN);
163 
168  void setLineStyle(LineStyle line_style);
169 
175 
183  void setWidth(double width);
184 
189  double getWidth() const;
190 
195  void setColor(const Color& color);
196 
201  const Color& getColor() const;
202 
207  void setCapStyle(CapStyle cap_style);
208 
214 
219  void setJoinStyle(JoinStyle join_style);
220 
226 
232  bool operator==(const Pen& pen) const;
233 
242  bool operator!=(const Pen& pen) const;
243 
244  private:
245  Color color;
246  LineStyle lineStyle;
247  CapStyle capStyle;
248  JoinStyle joinStyle;
249  double width;
250  };
251  } // namespace Vis
252 } // namespace CDPL
253 
254 #endif // CDPL_VIS_PEN_HPP
CDPL::Vis::Pen::getColor
const Color & getColor() const
Returns the color of the pen.
CDPL::Vis::Pen::setCapStyle
void setCapStyle(CapStyle cap_style)
Sets the line cap style to cap_style.
CDPL::Vis::Pen::NO_LINE
@ NO_LINE
Tells the renderer not to draw lines or shape outlines.
Definition: Pen.hpp:65
CDPL::Vis::Pen::DASH_DOT_LINE
@ DASH_DOT_LINE
Specifies a line with alternating dots and dashes.
Definition: Pen.hpp:85
CDPL::Vis::Pen::SQUARE_CAP
@ SQUARE_CAP
Specifies a squared line end that covers the end point and extends beyond it with half the line width...
Definition: Pen.hpp:107
CDPL::Vis::Pen::FLAT_CAP
@ FLAT_CAP
Specifies a squared line end that does not cover the end point of the line.
Definition: Pen.hpp:102
CDPL::Vis::Pen::CapStyle
CapStyle
Defines constants for supported line cap styles.
Definition: Pen.hpp:97
CDPL::Vis::Pen::MITER_JOIN
@ MITER_JOIN
Specifies a join style where the outer edges of the lines are extended to meet at an angle,...
Definition: Pen.hpp:124
CDPL::Vis::Pen::SOLID_LINE
@ SOLID_LINE
Specifies a solid line without gaps.
Definition: Pen.hpp:70
CDPL::Vis::Pen
Specifies how to draw lines and outlines of shapes.
Definition: Pen.hpp:53
CDPL::Vis::Pen::setWidth
void setWidth(double width)
Sets the line width to the specified value.
CDPL::Vis::Pen::setLineStyle
void setLineStyle(LineStyle line_style)
Sets the line style to line_style.
CDPL::Vis::Pen::DOT_LINE
@ DOT_LINE
Specifies a dotted line.
Definition: Pen.hpp:80
CDPL::Vis::Pen::operator==
bool operator==(const Pen &pen) const
Equality comparison operator.
CDPL_VIS_API
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Vis::Pen::Pen
Pen(LineStyle line_style)
Constructs a pen with the specified line style, line width 1.0, cap style Pen::ROUND_CAP,...
CDPL::Vis::Pen::Pen
Pen(const Color &color, double width=1.0, LineStyle line_style=SOLID_LINE, CapStyle cap_style=ROUND_CAP, JoinStyle join_style=ROUND_JOIN)
Constructs a pen with the specified color, line width, line style, cap style and join style.
CDPL::Vis::Pen::getWidth
double getWidth() const
Returns the line width.
CDPL::Vis::Pen::setColor
void setColor(const Color &color)
Sets the pen's color to the specified value.
CDPL::Vis::Pen::getCapStyle
CapStyle getCapStyle() const
Returns the line cap style.
CDPL::Vis::Pen::setJoinStyle
void setJoinStyle(JoinStyle join_style)
Sets the line join style to join_style.
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Vis::Pen::getJoinStyle
JoinStyle getJoinStyle() const
Returns the line join style.
CDPL::Vis::Pen::LineStyle
LineStyle
Defines constants for supported line styles.
Definition: Pen.hpp:60
CDPL::Vis::Pen::JoinStyle
JoinStyle
Defines constants for supported line join styles.
Definition: Pen.hpp:119
CDPL::Vis::Pen::getLineStyle
LineStyle getLineStyle() const
Returns the line style.
Color.hpp
Definition of the class CDPL::Vis::Color.
APIPrefix.hpp
Definition of the preprocessor macro CDPL_VIS_API.
CDPL::Vis::Color
Specifies a color in terms of its red, green and blue components and an alpha-channel for transparenc...
Definition: Color.hpp:52
CDPL::Vis::Pen::operator!=
bool operator!=(const Pen &pen) const
Inequality comparison operator.
CDPL::Vis::Pen::BEVEL_JOIN
@ BEVEL_JOIN
Specifies a join style where the triangular notch between the two lines is filled.
Definition: Pen.hpp:129
CDPL::Vis::Pen::DASH_LINE
@ DASH_LINE
Specifies a dashed line.
Definition: Pen.hpp:75
CDPL::Vis::Pen::Pen
Pen()
Constructs a pen with line style Pen::SOLID_LINE, line width 1.0, cap style Pen::ROUND_CAP,...