xtd 0.2.0
Loading...
Searching...
No Matches
pen.h
Go to the documentation of this file.
1
4#pragma once
5#include "../drawing_export.h"
10#include "drawing_2d/pen_type.h"
11#include "brush.h"
12#include "color.h"
13#include <xtd/iequatable>
14#include <xtd/object>
15#include <xtd/ustring>
16#include <cstdint>
17#include <memory>
18#include <ostream>
19
21namespace xtd {
23 namespace drawing {
35 class drawing_export_ pen final : public xtd::object, public xtd::iequatable<pen> {
36 struct data;
37
38 public:
40
46 template <typename brush_t>
47 explicit pen(const brush_t& brush) {
48 create_data();
49 this->brush(brush);
50 }
51
57 template<typename brush_t>
58 pen(const brush_t& brush, float width) {
59 create_data();
60 this->width(width);
61 this->brush(brush);
62 }
63
67 explicit pen(const xtd::drawing::color& color);
68
73 pen(const xtd::drawing::color& color, float width);
75
77 pen(const xtd::drawing::pen& value);
78 pen& operator =(const xtd::drawing::pen& value);
79 ~pen();
81
83
89
93 xtd::drawing::pen& alignment(xtd::drawing::drawing_2d::pen_alignment value);
94
98 const xtd::uptr<xtd::drawing::brush>& brush() const noexcept;
102 template<typename brush_t>
103 xtd::drawing::pen& brush(const brush_t& value) {
104 brush_(value.template memberwise_clone<brush_t>());
106 recreate_handle();
107 return *this;
108 }
109
112 const xtd::drawing::color& color() const noexcept;
116 xtd::drawing::pen& color(const xtd::drawing::color& value);
117
123 std::vector<float> dash_pattern() const noexcept;
129 xtd::drawing::pen& dash_pattern(const std::vector<float>& value);
130
134 xtd::drawing::drawing_2d::dash_style dash_style() const noexcept;
139 xtd::drawing::pen& dash_style(drawing::drawing_2d::dash_style value);
140
143 xtd::drawing::drawing_2d::line_cap end_cap() const noexcept;
147 xtd::drawing::pen& end_cap(xtd::drawing::drawing_2d::line_cap value);
148
151 intptr handle() const noexcept;
152
157 xtd::drawing::drawing_2d::line_join line_join() const noexcept;
163 xtd::drawing::pen& line_join(xtd::drawing::drawing_2d::line_join value);
164
169 float miter_limit() const noexcept;
175 xtd::drawing::pen& miter_limit(float value);
176
179 xtd::drawing::drawing_2d::line_cap start_cap() const noexcept;
183 xtd::drawing::pen& start_cap(xtd::drawing::drawing_2d::line_cap value);
184
188 xtd::drawing::drawing_2d::pen_type type() const noexcept;
189
193 float width() const noexcept;
198 xtd::drawing::pen& width(float value);
200
202 xtd::drawing::pen& dash_pattern(const std::initializer_list<float>& value);
204
206
208 using object::equals;
209 bool equals(const xtd::drawing::pen& value) const noexcept override;
210
211 xtd::ustring to_string() const noexcept override;
213
214 private:
215 pen();
216 void brush_(xtd::uptr<xtd::drawing::brush>&& brush);
217 void color_(const xtd::drawing::color& color);
218 void create_data();
219 void recreate_handle();
220
221 xtd::sptr<data> data_;
222 };
223 }
224}
Contains xtd::drawing::brush class.
Defines objects used to fill the interiors of graphical shapes such as rectangles,...
Definition brush.h:33
Represents an ARGB (alpha, red, green, blue) color.
Definition color.h:49
static const xtd::drawing::color empty
Represents a color that is null.
Definition color.h:55
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition pen.h:35
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.h:47
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.h:58
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.h:21
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:40
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:52
Contains xtd::drawing::color class.
Contains xtd::drawing::dash_style enum class.
Contains xtd::drawing::drawing_2d::pen_alignment enum class.
Contains xtd::drawing::drawing_2d::pen_type enum class.
#define drawing_export_
Define shared library export.
Definition drawing_export.h:13
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.h:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
std::type_info type
Stores information about a type.
Definition type.h:23
pen_alignment
Specifies the alignment of a xtd::drawing::pen object in relation to the theoretical,...
Definition pen_alignment.h: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.h:10