xtd 0.2.0
point_f.h
Go to the documentation of this file.
1 #pragma once
5 #include "../drawing_export.h"
6 #include <xtd/iequatable>
7 #include <xtd/object>
8 #include <xtd/ustring>
9 #include <cstdint>
10 #include <ostream>
11 #include <string>
12 
14 namespace xtd {
16  namespace drawing {
18  class point;
19  class point_f;
20  class size;
21  class size_f;
23 
35  class drawing_export_ point_f : public xtd::object, public xtd::iequatable<point_f> {
36  public:
38 
41  static const point_f empty;
43 
45 
49  point_f() noexcept = default;
53  point_f(float x, float y) noexcept;
56  explicit point_f(const size_f& sz) noexcept;
58 
60  point_f(const point_f&) noexcept = default;
61  point_f& operator =(const point_f&) noexcept = default;
63 
65 
69  bool is_empty() const noexcept;
70 
73  float x() const noexcept;
74 
77  void x(float x) noexcept;
78 
81  float y() const noexcept;
82 
85  void y(float y) noexcept;
87 
89 
96  static point_f add(const point_f& pt, const size& sz) noexcept;
102  static point_f add(const point_f& pt, const size_f& sz) noexcept;
107  static point_f add(const point_f& pt1, const point& pt2) noexcept;
112  static point_f add(const point_f& pt1, const point_f& pt2) noexcept;
113 
114  bool equals(const point_f& value) const noexcept override;
115 
119  void offset(float dx, float dy) noexcept;
120 
124  void offset(const point_f& pt) noexcept;
125 
131  static point_f subtract(const point_f& pt, const size& sz) noexcept;
137  static point_f subtract(const point_f& pt, const size_f& sz) noexcept;
142  static point_f subtract(const point_f& pt1, const point& pt2) noexcept;
147  static point_f subtract(const point_f& pt1, const point_f& pt2) noexcept;
148 
151  xtd::ustring to_string() const noexcept override;
153 
155 
160  point_f operator +(const size& sz) const noexcept;
164  point_f operator +(const size_f& sz) const noexcept;
168  point_f operator +(const point& pt) const noexcept;
172  point_f operator +(const point_f& pt) const noexcept;
173 
177  point_f& operator +=(const size& sz) noexcept;
181  point_f& operator +=(const size_f& sz) noexcept;
185  point_f& operator +=(const point& pt) noexcept;
189  point_f& operator +=(const point_f& pt) noexcept;
190 
194  point_f operator -(const size& sz) const noexcept;
198  point_f operator -(const size_f& sz) const noexcept;
202  point_f operator -(const point& pt) const noexcept;
206  point_f operator -(const point_f& pt) const noexcept;
207 
211  point_f& operator -=(const size& sz) noexcept;
215  point_f& operator -=(const size_f& sz) noexcept;
219  point_f& operator -=(const point& pt) noexcept;
223  point_f& operator -=(const point_f& pt) noexcept;
225 
226  private:
227  float x_ = 0;
228  float y_ = 0;
229  };
230  }
231 }
static const point_f empty
Represents a xtd::drawing::point_f that has xtd::drawing::point_f::x and xtd::drawing::point_f::y val...
Definition: point_f.h:41
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:31
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1063
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition: point_f.h:35
Stores an ordered pair of floating-point, which specify a height and width.
Definition: size_f.h:31
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
Specifies a printer&#39;s point (1/72 inch) as the unit of measure.
size_t size
Represents a size of any object in bytes.
Definition: types.h:195