Chemical Data Processing Library C++ API - Version 1.2.0
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
Definition of the class CDPL::Vis::Color.
Definition of the preprocessor macro CDPL_VIS_API.
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Specifies a color in terms of its red, green and blue components and an alpha-channel for transparenc...
Definition: Color.hpp:52
Specifies how to draw lines and outlines of shapes.
Definition: Pen.hpp:53
Pen(LineStyle line_style)
Constructs a pen with the specified line style, line width 1.0, cap style Pen::ROUND_CAP,...
void setLineStyle(LineStyle line_style)
Sets the line style to line_style.
CapStyle
Defines constants for supported line cap styles.
Definition: Pen.hpp:97
@ FLAT_CAP
Specifies a squared line end that does not cover the end point of the line.
Definition: Pen.hpp:102
@ 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
double getWidth() const
Returns the line width.
void setColor(const Color &color)
Sets the pen's color to the specified value.
JoinStyle
Defines constants for supported line join styles.
Definition: Pen.hpp:119
@ MITER_JOIN
Specifies a join style where the outer edges of the lines are extended to meet at an angle,...
Definition: Pen.hpp:124
@ BEVEL_JOIN
Specifies a join style where the triangular notch between the two lines is filled.
Definition: Pen.hpp:129
CapStyle getCapStyle() const
Returns the line cap style.
Pen()
Constructs a pen with line style Pen::SOLID_LINE, line width 1.0, cap style Pen::ROUND_CAP,...
void setWidth(double width)
Sets the line width to the specified value.
LineStyle
Defines constants for supported line styles.
Definition: Pen.hpp:60
@ DOT_LINE
Specifies a dotted line.
Definition: Pen.hpp:80
@ DASH_DOT_LINE
Specifies a line with alternating dots and dashes.
Definition: Pen.hpp:85
@ DASH_LINE
Specifies a dashed line.
Definition: Pen.hpp:75
@ SOLID_LINE
Specifies a solid line without gaps.
Definition: Pen.hpp:70
@ NO_LINE
Tells the renderer not to draw lines or shape outlines.
Definition: Pen.hpp:65
void setJoinStyle(JoinStyle join_style)
Sets the line join style to join_style.
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.
JoinStyle getJoinStyle() const
Returns the line join style.
bool operator==(const Pen &pen) const
Equality comparison operator.
const Color & getColor() const
Returns the color of the pen.
void setCapStyle(CapStyle cap_style)
Sets the line cap style to cap_style.
LineStyle getLineStyle() const
Returns the line style.
bool operator!=(const Pen &pen) const
Inequality comparison operator.
The namespace of the Chemical Data Processing Library.