Chemical Data Processing Library C++ API - Version 1.2.0
|
Specifies how to draw lines and outlines of shapes. More...
#include <Pen.hpp>
Public Types | |
enum | LineStyle { NO_LINE , SOLID_LINE , DASH_LINE , DOT_LINE , DASH_DOT_LINE , DASH_DOT_DOT_LINE } |
Defines constants for supported line styles. More... | |
enum | CapStyle { FLAT_CAP , SQUARE_CAP , ROUND_CAP } |
Defines constants for supported line cap styles. More... | |
enum | JoinStyle { MITER_JOIN , BEVEL_JOIN , ROUND_JOIN } |
Defines constants for supported line join styles. More... | |
Public Member Functions | |
Pen () | |
Constructs a pen with line style Pen::SOLID_LINE, line width 1.0, cap style Pen::ROUND_CAP, join style Pen::ROUND_JOIN and color Color::BLACK. More... | |
Pen (LineStyle line_style) | |
Constructs a pen with the specified line style, line width 1.0, cap style Pen::ROUND_CAP, join style Pen::ROUND_JOIN and color Color::BLACK. More... | |
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. More... | |
void | setLineStyle (LineStyle line_style) |
Sets the line style to line_style. More... | |
LineStyle | getLineStyle () const |
Returns the line style. More... | |
void | setWidth (double width) |
Sets the line width to the specified value. More... | |
double | getWidth () const |
Returns the line width. More... | |
void | setColor (const Color &color) |
Sets the pen's color to the specified value. More... | |
const Color & | getColor () const |
Returns the color of the pen. More... | |
void | setCapStyle (CapStyle cap_style) |
Sets the line cap style to cap_style. More... | |
CapStyle | getCapStyle () const |
Returns the line cap style. More... | |
void | setJoinStyle (JoinStyle join_style) |
Sets the line join style to join_style. More... | |
JoinStyle | getJoinStyle () const |
Returns the line join style. More... | |
bool | operator== (const Pen &pen) const |
Equality comparison operator. More... | |
bool | operator!= (const Pen &pen) const |
Inequality comparison operator. More... | |
Specifies how to draw lines and outlines of shapes.
A pen has a line style, width, color, cap style and join style attribute. The line style specifies how a line will look like (solid, dashed, ...). The default line style is Pen::SOLID_LINE. Setting the line style to Pen::NO_LINE tells the renderer not to draw lines or outlines. The pen color defines the color of lines and text. The default line color is Color::BLACK. The cap style specifies how the end points of lines are drawn and the join style defines how the joins between two or more connected have to be drawn. The default cap style is Pen::ROUND_CAP and the default join style is Pen::ROUND_JOIN.
Defines constants for supported line styles.
Defines constants for supported line join styles.
CDPL::Vis::Pen::Pen | ( | ) |
Constructs a pen with line style Pen::SOLID_LINE, line width 1.0, cap style Pen::ROUND_CAP, join style Pen::ROUND_JOIN and color Color::BLACK.
CDPL::Vis::Pen::Pen | ( | LineStyle | line_style | ) |
Constructs a pen with the specified line style, line width 1.0, cap style Pen::ROUND_CAP, join style Pen::ROUND_JOIN and color Color::BLACK.
line_style | The line style. |
CDPL::Vis::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.
If width is negative, the line width is set to zero.
color | The pen color. |
width | The line width. |
line_style | The line style. |
cap_style | The line cap style. |
join_style | The line join style. |
void CDPL::Vis::Pen::setLineStyle | ( | LineStyle | line_style | ) |
Sets the line style to line_style.
line_style | The line style. |
LineStyle CDPL::Vis::Pen::getLineStyle | ( | ) | const |
Returns the line style.
void CDPL::Vis::Pen::setWidth | ( | double | width | ) |
Sets the line width to the specified value.
If width is negative, the line width is set to zero.
width | The line width. |
double CDPL::Vis::Pen::getWidth | ( | ) | const |
Returns the line width.
void CDPL::Vis::Pen::setColor | ( | const Color & | color | ) |
Sets the pen's color to the specified value.
color | The color of the pen. |
const Color& CDPL::Vis::Pen::getColor | ( | ) | const |
Returns the color of the pen.
void CDPL::Vis::Pen::setCapStyle | ( | CapStyle | cap_style | ) |
Sets the line cap style to cap_style.
cap_style | The line cap style. |
CapStyle CDPL::Vis::Pen::getCapStyle | ( | ) | const |
Returns the line cap style.
void CDPL::Vis::Pen::setJoinStyle | ( | JoinStyle | join_style | ) |
Sets the line join style to join_style.
join_style | The line join style. |
JoinStyle CDPL::Vis::Pen::getJoinStyle | ( | ) | const |
Returns the line join style.
Equality comparison operator.
pen | The other Pen object to be compared with. |
true
if all pen attributes compare equal, and false
otherwise. Inequality comparison operator.
The result is equivalent to !(*this == pen)
.
pen | The other Pen object to be compared with. |
true
if the pen attributes compare non-equal, and false
otherwise.