Pen Class Reference

#include <Pt/Gfx/Pen.h>

Attributes for the drawing of outlines. More...

Public Types

enum  Style
 Identifies how outlines are stroked.
 
enum  CapStyle
 Identifies how open line ends are rendered.
 
enum  JoinStyle
 Identifies how connected line segments are joined.
 

Public Member Functions

 Pen ()
 Constructs a null pen. More...
 
 Pen (const Color &color)
 Constructs a pen with the specified color. More...
 
 Pen (const Color &color, std::size_t width, Style style=Solid, CapStyle cap=FlatCap, JoinStyle join=BevelJoin)
 Constructs a pen with the specified size, color and styles.
 
 Pen (const Color &color, std::size_t width, const std::vector< Pt::uint8_t > &dashPattern, CapStyle cap=FlatCap, JoinStyle join=BevelJoin)
 Constructs a pen with a custom dash pattern.
 
bool isNull () const
 Returns true if the pen is null.
 
void setSize (std::size_t size)
 Sets the size of the pen.
 
std::size_t size () const
 Returns the size of the pen.
 
void setColor (const Color &color)
 Sets the color of the pen.
 
const Colorcolor () const
 Returns the color of the pen.
 
void setStyle (Style style=Solid)
 Sets the pen style.
 
Style style () const
 Returns the pen style.
 
bool isSolid () const
 Returns true if the pen is solid.
 
void setDashPattern (const std::vector< Pt::uint8_t > &dashPattern)
 Sets the pen user dash pattern.
 
const std::vector< Pt::uint8_t > & dashPattern () const
 Returns the pen user dash pattern.
 
void setCapStyle (CapStyle cap=FlatCap)
 Sets the cap style.
 
CapStyle capStyle () const
 Returns the cap style.
 
void setJoinStyle (JoinStyle join=BevelJoin)
 Sets the join style.
 
JoinStyle joinStyle () const
 Returns the join style.
 
const void * instance () const
 Returns an implementation-specific pen instance.
 

Detailed Description

Pen objects are used as container of drawing attributes for Painter objects. A size and a color can be specified per pen. The size and color are used to draw outlined shapes by the Painter. Outlined shapes for example are lines, outlined rectangles or ellipses and text.

Constructor & Destructor Documentation

◆ Pen() [1/2]

Pen ( )

The default pen is null.

◆ Pen() [2/2]

Pen ( const Color color)

The pen size is 1, the style is solid and the cap and join styles are round.