xtd 1.0.0
Loading...
Searching...
No Matches
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<typename brush_t>
46 explicit pen(const brush_t& brush) {
47 create_data();
48 this->brush(brush);
49 }
50
56 template<typename 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 auto operator =(const xtd::drawing::pen& value) -> xtd::drawing::pen&;
78 ~pen();
80
82
87 [[nodiscard]] auto alignment() const noexcept -> xtd::drawing::drawing_2d::pen_alignment;
91 auto alignment(xtd::drawing::drawing_2d::pen_alignment value) -> xtd::drawing::pen&;
92
96 [[nodiscard]] auto brush() const noexcept -> const xtd::uptr<xtd::drawing::brush>&;
100 template<typename brush_t>
101 auto brush(const brush_t& value) -> xtd::drawing::pen& {
102 brush_(value.template memberwise_clone<brush_t>());
104 recreate_handle();
105 return *this;
106 }
107
110 [[nodiscard]] auto color() const noexcept -> const xtd::drawing::color&;
114 auto color(const xtd::drawing::color& value) -> xtd::drawing::pen&;
115
121 [[nodiscard]] auto dash_pattern() const noexcept -> xtd::array<float>;
127 auto dash_pattern(const xtd::array<float>& value) -> xtd::drawing::pen&;
128
132 [[nodiscard]] auto dash_style() const noexcept -> xtd::drawing::drawing_2d::dash_style;
138
141 [[nodiscard]] auto end_cap() const noexcept -> xtd::drawing::drawing_2d::line_cap;
145 auto end_cap(xtd::drawing::drawing_2d::line_cap value) -> xtd::drawing::pen&;
146
149 [[nodiscard]] auto handle() const noexcept -> xtd::intptr;
150
155 [[nodiscard]] auto line_join() const noexcept -> xtd::drawing::drawing_2d::line_join;
162
167 [[nodiscard]] float miter_limit() const noexcept;
173 auto miter_limit(float value) -> xtd::drawing::pen&;
174
177 [[nodiscard]] auto start_cap() const noexcept -> xtd::drawing::drawing_2d::line_cap;
181 auto start_cap(xtd::drawing::drawing_2d::line_cap value) -> xtd::drawing::pen&;
182
186 [[nodiscard]] auto type() const noexcept -> xtd::drawing::drawing_2d::pen_type;
187
191 [[nodiscard]] auto width() const noexcept -> float;
196 auto width(float value) -> xtd::drawing::pen&;
198
200 auto dash_pattern(const std::initializer_list<float>& value) -> xtd::drawing::pen&;
202
204
209 [[nodiscard]] auto equals(const object& obj) const noexcept -> bool override;
213 [[nodiscard]] auto equals(const xtd::drawing::pen& other) const noexcept -> bool override;
214
217 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
218
219 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
221
222 private:
223 auto brush_(xtd::uptr<xtd::drawing::brush>&& brush) -> void;
224 auto color_(const xtd::drawing::color& color) -> void;
225 auto create_data() -> void;
226 auto recreate_handle() -> void;
227
228 xtd::sptr<data> data_;
229 };
230 }
231}
Contains xtd::drawing::brush class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:52
static const xtd::drawing::color empty
Represents a color that is null.
Definition color.hpp:58
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition pen.hpp:32
auto brush() const noexcept -> const xtd::uptr< xtd::drawing::brush > &
Gets the xtd::drawing::brush that determines attributes of this xtd::drawing::pen.
auto equals(const object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto end_cap() const noexcept -> xtd::drawing::drawing_2d::line_cap
Gets the cap style used at the end of lines drawn with this xtd::drawing::pen.
auto start_cap() const noexcept -> xtd::drawing::drawing_2d::line_cap
Gets the cap style used at the beginning of lines drawn with this xtd::drawing::pen.
auto dash_style() const noexcept -> xtd::drawing::drawing_2d::dash_style
Gets the style used for dashed lines drawn with this xtd::drawing::pen.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
auto alignment() const noexcept -> xtd::drawing::drawing_2d::pen_alignment
Gets the alignment for this xtd::drawing::pen.
float miter_limit() const noexcept
Gets the limit of the thickness of the join on a mitered corner.
pen()
Initializes a new instance of the xtd::drawing::pen class with xtd::drawing::color::black and width o...
auto dash_pattern() const noexcept -> xtd::array< float >
Gets an array of custom dashes and spaces.
auto width() const noexcept -> float
Gets the width of this xtd::drawing::pen, in units of the xtd::drawing::graphics object used for draw...
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
auto handle() const noexcept -> xtd::intptr
Gets the handle of the pen.
auto color() const noexcept -> const xtd::drawing::color &
Gets the color of this xtd::drawing::pen.
auto line_join() const noexcept -> xtd::drawing::drawing_2d::line_join
Gets the join style for the ends of two consecutive 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
auto type() const noexcept -> xtd::drawing::drawing_2d::pen_type
Gets the style of lines drawn with this xtd::drawing::pen.
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
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:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
auto memberwise_clone() const -> xtd::unique_ptr_object< object_t >
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
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
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 auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
Contains xtd::drawing::drawing_2d::pen_alignment enum class.
Contains xtd::drawing::drawing_2d::pen_type enum class.