xtd 1.0.0
Loading...
Searching...
No Matches
point.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "point_f.hpp"
7#include <xtd/iequatable>
8#include <xtd/object>
9#include <xtd/string>
10#include <cstdint>
11#include <ostream>
12
14namespace xtd {
16 namespace drawing {
18 struct size;
20
56
59 static const point empty;
61
63
67 point() noexcept = default;
68
91 explicit point(int32 dw) noexcept;
92
115 point(xtd::int32 x, xtd::int32 y) noexcept;
116
138 explicit point(const size& sz) noexcept;
140
142 operator xtd::drawing::point_f() const noexcept;
144
146
150 [[nodiscard]] auto is_empty() const noexcept -> bool;
151
173 xtd::int32 x = 0;
174
196 xtd::int32 y = 0;
198
200
205 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
209 [[nodiscard]] auto equals(const point& other) const noexcept -> bool override;
210
213 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
214
218 auto offset(xtd::int32 dx, xtd::int32 dy) noexcept -> void;
219
233 auto offset(const point& p) noexcept -> void;
234
237 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
239
241
257 [[nodiscard]] static auto add(const point& pt, const xtd::drawing::size& sz) noexcept -> point;
262 [[nodiscard]] static auto add(const point& pt1, const point& pt2) noexcept -> point;
263
267 [[nodiscard]] static auto ceiling(const xtd::drawing::point_f& value) noexcept -> point;
268
272 [[nodiscard]] static auto round(const xtd::drawing::point_f& value) noexcept -> point;
273
279 [[nodiscard]] static auto subtract(const point& pt, const size& sz) noexcept -> point;
284 [[nodiscard]] static auto subtract(const point& pt1, const point& pt2) noexcept -> point;
285
289 [[nodiscard]] static auto truncate(const xtd::drawing::point_f& value) noexcept -> point;
291
293
298 auto operator +(const xtd::drawing::size& sz) const noexcept -> point;
302 auto operator +(const point& pt) const noexcept -> point;
303
307 auto operator +=(const xtd::drawing::size& sz) noexcept -> point&;
311 auto operator +=(const point& pt) noexcept -> point&;
312
316 auto operator -(const xtd::drawing::size& sz) const noexcept -> point;
320 auto operator -(const point& pt) const noexcept -> point;
321
325 auto operator -=(const xtd::drawing::size& sz) noexcept -> point&;
329 auto operator -=(const point& pt) noexcept -> point&;
331 };
332 }
333
334 template<>
335 [[nodiscard]] inline auto parse<drawing::point>(const std::string& str) -> drawing::point {
336 auto values = xtd::string(str).replace("}", xtd::string::empty_string).replace(" y=", xtd::string::empty_string).replace("{x=", xtd::string::empty_string).split(',');
337 return {xtd::parse<int32>(values[0]), xtd::parse<int32>(values[1])};
338 }
339}
static const basic_string empty_string
Definition basic_string.hpp:111
auto replace(value_type old_char, value_type new_char) const noexcept -> basic_string
Replaces all occurrences of a specified char_t in this basic_string with another specified char_t.
Definition basic_string.hpp:711
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
Contains drawing_export_ keyword.
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
auto parse(const std::string &str) -> value_t
Convert a string into a type.
Definition parse.hpp:34
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
Contains xtd::drawing::point_f struct.
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.hpp:35
auto is_empty() const noexcept -> bool
Gets a value indicating whether this xtd::drawing::point is empty.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
xtd::int32 y
Gets or sets the y-coordinate of this xtd::drawing::point.
Definition point.hpp:196
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
static auto round(const xtd::drawing::point_f &value) noexcept -> point
Converts the specified xtd::drawing::point_f to a point object by rounding the xtd::drawing::point_f ...
static auto subtract(const point &pt, const size &sz) noexcept -> point
Returns the result of subtracting specified xtd::drawing::size from the specified xtd::drawing::point...
static const point empty
Represents a xtd::drawing::point that has xtd::drawing::point::x and xtd::drawing::point::y values se...
Definition point.hpp:59
auto to_string() const noexcept -> xtd::string override
Converts this point to a human-readable string.
static auto add(const point &pt, const xtd::drawing::size &sz) noexcept -> point
Adds the specified xtd::drawing::size to the specified xtd::drawing::point.
point() noexcept=default
Initializes a new instance of the xtd::drawing::point class.
static auto truncate(const xtd::drawing::point_f &value) noexcept -> point
Converts the specified xtd::drawing::point_f to a point by truncating the values of the xtd::drawing:...
static auto ceiling(const xtd::drawing::point_f &value) noexcept -> point
Converts the specified xtd::drawing::point_f to a point by rounding the values of the xtd::drawing::p...
xtd::int32 x
Gets or sets the x-coordinate of this xtd::drawing::point.
Definition point.hpp:173
auto offset(xtd::int32 dx, xtd::int32 dy) noexcept -> void
Translates this xtd::drawing::point by the specified amount.
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:32