xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Classes | Public Member Functions | List of all members
xtd::drawing::pen Class Referencefinal

#include <pen.h>

Definition

Defines an object used to draw lines and curves. This class cannot be inherited.

Library
xtd.drawing
Examples:
user_control.cpp.

Public Member Functions

 pen (const xtd::drawing::brush &brush)
 Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::brush. More...
 
 pen (const xtd::drawing::brush &brush, float width)
 Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::brush. More...
 
 pen (const xtd::drawing::color &color)
 Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::color. More...
 
 pen (const xtd::drawing::color &color, float width)
 Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::color. More...
 
xtd::drawing::drawing2d::pen_alignment alignment () const
 Gets the alignment for this xtd::drawing::pen. More...
 
xtd::drawing::penalignment (xtd::drawing::drawing2d::pen_alignment alignment)
 Sets the alignment for this xtd::drawing::pen. More...
 
std::unique_ptr< xtd::drawing::brushbrush () const
 
xtd::drawing::penbrush (const xtd::drawing::brush &brush)
 
const xtd::drawing::colorcolor () const
 
xtd::drawing::pencolor (const xtd::drawing::color &color)
 
std::vector< float > dash_pattern () const
 
xtd::drawing::pendash_pattern (const std::initializer_list< float > &il)
 
xtd::drawing::pendash_pattern (const std::vector< float > &dash_pattern)
 
xtd::drawing::dash_style dash_style () const
 
xtd::drawing::pendash_style (drawing::dash_style dash_style)
 
xtd::ustring to_string () const noexcept override
 Returns a std::string that represents the current object. More...
 
xtd::drawing::drawing2d::pen_type type () const
 
xtd::drawing::pentype (xtd::drawing::drawing2d::pen_type type)
 
float width () const
 
xtd::drawing::penwidth (float width)
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

Constructor & Destructor Documentation

◆ pen() [1/4]

xtd::drawing::pen::pen ( const xtd::drawing::brush brush)

Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::brush.

Parameters
brushA xtd::drawing::brush that determines the fill properties of this xtd::drawing::pen.
Remarks
The brush property determines how the xtd::drawing::pen draws lines. Lines are drawn as if they are filled rectangles, with the characteristics of the specified brush.
The width property of the new xtd::drawing::pen is set to 1 (the default).

◆ pen() [2/4]

xtd::drawing::pen::pen ( const xtd::drawing::brush brush,
float  width 
)

Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::brush.

Parameters
brushA xtd::drawing::brush that determines the fill properties of this xtd::drawing::pen.
widthA single number that represent the pen width.
Remarks
The brush property determines how the xtd::drawing::pen draws lines. Lines are drawn as if they are filled rectangles, with the characteristics of the specified brush.
The width property of the new xtd::drawing::pen is set to 1 (the default).

◆ pen() [3/4]

xtd::drawing::pen::pen ( const xtd::drawing::color color)

Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::color.

Parameters
colorA xtd::drawing::color structure that indicates the color of this xtd::drawing::pen.
Remarks
The color property is set to the color specified by the color parameter. The width property is set to 1 (the default).

◆ pen() [4/4]

xtd::drawing::pen::pen ( const xtd::drawing::color color,
float  width 
)

Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::color.

Parameters
colorA xtd::drawing::color structure that indicates the color of this xtd::drawing::pen.
widthA single number that represent the pen width.
Remarks
The color property is set to the color specified by the color parameter. The width property is set to 1 (the default).

Member Function Documentation

◆ alignment() [1/2]

xtd::drawing::drawing2d::pen_alignment xtd::drawing::pen::alignment ( ) const
inline

Gets the alignment for this xtd::drawing::pen.

Returns
A xtd::drawing2d::pen_alignment that represents the alignment for this xtd::drawing::pen.
Remarks
This property determines how the xtd::drawing::pen draws closed curves and polygons. The td::drawing2d::pen_alignment enumeration specifies five values; however, only two values - td::drawing2d::pen_alignment::center and td::drawing2d::pen_alignment::inset - will change the appearance of a drawn line. td::drawing2d::pen_alignment::center is the default value for this property and specifies that the width of the pen is centered on the outline of the curve or polygon. A value of td::drawing2d::pen_alignment::inset for this property specifies that the width of the pen is inside the outline of the curve or polygon. The other three values, td::drawing2d::pen_alignment::right, td::drawing2d::pen_alignment::left, and td::drawing2d::pen_alignment::outset, will result in a pen that is centered.

◆ alignment() [2/2]

xtd::drawing::pen& xtd::drawing::pen::alignment ( xtd::drawing::drawing2d::pen_alignment  alignment)

Sets the alignment for this xtd::drawing::pen.

Parameters
alignmentA xtd::drawing2d::pen_alignment that represents the alignment for this xtd::drawing::pen.
Remarks
This property determines how the xtd::drawing::pen draws closed curves and polygons. The td::drawing2d::pen_alignment enumeration specifies five values; however, only two values - td::drawing2d::pen_alignment::center and td::drawing2d::pen_alignment::inset - will change the appearance of a drawn line. td::drawing2d::pen_alignment::center is the default value for this property and specifies that the width of the pen is centered on the outline of the curve or polygon. A value of td::drawing2d::pen_alignment::inset for this property specifies that the width of the pen is inside the outline of the curve or polygon. The other three values, td::drawing2d::pen_alignment::right, td::drawing2d::pen_alignment::left, and td::drawing2d::pen_alignment::outset, will result in a pen that is centered.

◆ to_string()

xtd::ustring xtd::drawing::pen::to_string ( ) const
inlineoverridevirtualnoexcept

Returns a std::string that represents the current object.

Returns
A string that represents the current object.
Examples
The following code example demonstrates what to_string returns.

Reimplemented from xtd::object.


The documentation for this class was generated from the following file: