xtd 0.2.0
pen.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../drawing_export.hpp"
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
72 pen(const xtd::drawing::color& color, float width);
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
133 xtd::drawing::drawing_2d::dash_style dash_style() const noexcept;
138 xtd::drawing::pen& dash_style(drawing::drawing_2d::dash_style value);
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
156 xtd::drawing::drawing_2d::line_join line_join() const noexcept;
162 xtd::drawing::pen& line_join(xtd::drawing::drawing_2d::line_join value);
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;
182 xtd::drawing::pen& start_cap(xtd::drawing::drawing_2d::line_cap value);
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
Defines objects used to fill the interiors of graphical shapes such as rectangles,...
Definition brush.hpp:33
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
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.
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.
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:43
The xtd::shared_ptr_object is a shared pointer as std::shared_ptr.
Definition shared_ptr_object.hpp:30
Contains xtd::drawing::color class.
Contains xtd::drawing::drawing_2d::dash_style enum class.
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
std::unique_ptr< 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
std::type_info type
Stores information about a type.
Definition type.hpp:23
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 namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
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