xtd 0.2.0
pen.hpp
Go to the documentation of this file.
1
4#pragma once
11#include "brush.hpp"
12#include "color.hpp"
13#include <xtd/iequatable>
14#include <xtd/object>
15#include <xtd/string>
16
18namespace xtd {
20 namespace drawing {
32 class drawing_export_ pen final : public xtd::object, public xtd::iequatable<pen> {
33 struct data;
34
35 public:
37
40 pen();
45 template<class brush_t>
46 explicit pen(const brush_t& brush) {
47 create_data();
48 this->brush(brush);
49 }
50
56 template<class brush_t>
57 pen(const brush_t& brush, float width) {
58 create_data();
59 this->width(width);
60 this->brush(brush);
61 }
62
66 explicit pen(const xtd::drawing::color& color);
67
74
76 pen(const xtd::drawing::pen& value);
77 pen& operator =(const xtd::drawing::pen& value);
78 ~pen();
80
82
88
92 xtd::drawing::pen& alignment(xtd::drawing::drawing_2d::pen_alignment value);
93
97 const xtd::uptr<xtd::drawing::brush>& brush() const noexcept;
101 template<class brush_t>
102 xtd::drawing::pen& brush(const brush_t& value) {
103 brush_(value.template memberwise_clone<brush_t>());
105 recreate_handle();
106 return *this;
107 }
108
111 const xtd::drawing::color& color() const noexcept;
115 xtd::drawing::pen& color(const xtd::drawing::color& value);
116
122 xtd::array<float> dash_pattern() const noexcept;
128 xtd::drawing::pen& dash_pattern(const xtd::array<float>& value);
129
139
142 xtd::drawing::drawing_2d::line_cap end_cap() const noexcept;
146 xtd::drawing::pen& end_cap(xtd::drawing::drawing_2d::line_cap value);
147
150 intptr handle() const noexcept;
151
163
168 float miter_limit() const noexcept;
174 xtd::drawing::pen& miter_limit(float value);
175
178 xtd::drawing::drawing_2d::line_cap start_cap() const noexcept;
183
187 xtd::drawing::drawing_2d::pen_type type() const noexcept;
188
192 float width() const noexcept;
197 xtd::drawing::pen& width(float value);
199
201 xtd::drawing::pen& dash_pattern(const std::initializer_list<float>& value);
203
205
210 bool equals(const object& obj) const noexcept override;
214 bool equals(const xtd::drawing::pen& other) const noexcept override;
215
218 xtd::size get_hash_code() const noexcept override;
219
220 xtd::string to_string() const noexcept override;
222
223 private:
224 void brush_(xtd::uptr<xtd::drawing::brush>&& brush);
225 void color_(const xtd::drawing::color& color);
226 void create_data();
227 void recreate_handle();
228
229 xtd::sptr<data> data_;
230 };
231 }
232}
Contains xtd::drawing::brush class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:46
static const xtd::drawing::color empty
Represents a color that is null.
Definition color.hpp:52
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition pen.hpp:32
xtd::drawing::drawing_2d::line_cap end_cap() const noexcept
Gets the cap style used at the end of lines drawn with this xtd::drawing::pen.
bool equals(const object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
float width() const noexcept
Gets the width of this xtd::drawing::pen, in units of the xtd::drawing::graphics object used for draw...
intptr handle() const noexcept
Gets the handle of the pen.
float miter_limit() const noexcept
Gets the limit of the thickness of the join on a mitered corner.
const xtd::uptr< xtd::drawing::brush > & brush() const noexcept
Gets the xtd::drawing::brush that determines attributes of this xtd::drawing::pen.
xtd::drawing::drawing_2d::pen_type type() const noexcept
Gets the style of lines drawn with this xtd::drawing::pen.
pen()
Initializes a new instance of the xtd::drawing::pen class with xtd::drawing::color::black and width o...
const xtd::drawing::color & color() const noexcept
Gets the color of this xtd::drawing::pen.
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
xtd::drawing::drawing_2d::line_join line_join() const noexcept
Gets the join style for the ends of two consecutive lines drawn with this xtd::drawing::pen.
xtd::drawing::drawing_2d::line_cap start_cap() const noexcept
Gets the cap style used at the beginning of lines drawn with this xtd::drawing::pen.
xtd::drawing::drawing_2d::dash_style dash_style() const noexcept
Gets the style used for dashed lines drawn with this xtd::drawing::pen.
pen(const brush_t &brush)
Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::brush.
Definition pen.hpp:46
pen(const brush_t &brush, float width)
Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::brush.
Definition pen.hpp:57
xtd::drawing::drawing_2d::pen_alignment alignment() const noexcept
Gets the alignment for this 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.
xtd::array< float > dash_pattern() const noexcept
Gets an array of custom dashes and spaces.
pen(const xtd::drawing::color &color)
Initializes a new instance of the xtd::drawing::pen class with the specified xtd::drawing::color.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
xtd::unique_ptr_object< object_t > memberwise_clone() const
Creates a shallow copy of the current object.
Contains xtd::drawing::drawing_2d::dash_style enum class.
Contains xtd::drawing::color class.
Contains drawing_export_ keyword.
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
@ other
The operating system is other.
Definition platform_id.hpp:58
pen_alignment
Specifies the alignment of a xtd::drawing::pen object in relation to the theoretical,...
Definition pen_alignment.hpp:21
Contains xtd::drawing::drawing_2d::line_cap enum class.
Contains xtd::drawing::drawing_2d::line_join enum class.
The xtd::drawing::drawing_2d namespace provides advanced two-dimensional and vector graphics function...
Definition compositing_mode.hpp:12
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::drawing::drawing_2d::pen_alignment enum class.
Contains xtd::drawing::drawing_2d::pen_type enum class.
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:31