xtd - Reference Guide 0.2.0
point_f.h
Go to the documentation of this file.
1 #pragma once
5 #include <cstdint>
6 #include <ostream>
7 #include <string>
8 #include <xtd/object.h>
9 #include <xtd/ustring.h>
10 #include "../drawing_export.h"
11 
13 namespace xtd {
15  namespace drawing {
17  class point;
18  class point_f;
19  class size;
20  class size_f;
22 
34  class drawing_export_ point_f : public object {
35  public:
37 
40  static const point_f empty;
42 
44 
48  point_f() noexcept = default;
52  point_f(float x, float y) noexcept;
55  explicit point_f(const size_f& sz) noexcept;
57 
59  point_f(const point_f&) noexcept = default;
60  point_f& operator =(const point_f&) noexcept = default;
62 
64 
68  bool is_empty() const noexcept;
69 
72  float x() const noexcept;
73 
76  void x(float x) noexcept;
77 
80  float y() const noexcept;
81 
84  void y(float y) noexcept;
86 
88 
95  static point_f add(const point_f& pt, const size& sz) noexcept;
101  static point_f add(const point_f& pt, const size_f& sz) noexcept;
106  static point_f add(const point_f& pt1, const point& pt2) noexcept;
111  static point_f add(const point_f& pt1, const point_f& pt2) noexcept;
112 
116  void offset(float dx, float dy) noexcept;
117 
121  void offset(const point_f& pt) noexcept;
122 
128  static point_f subtract(const point_f& pt, const size& sz) noexcept;
134  static point_f subtract(const point_f& pt, const size_f& sz) noexcept;
139  static point_f subtract(const point_f& pt1, const point& pt2) noexcept;
144  static point_f subtract(const point_f& pt1, const point_f& pt2) noexcept;
145 
148  xtd::ustring to_string() const noexcept override;
150 
152  bool operator ==(const point_f& value) const noexcept {return x_ == value.x_ && y_ == value.y_;}
153  bool operator !=(const point_f& value) const noexcept {return !operator ==(value);}
155 
157 
162  point_f operator +(const size& sz) const noexcept;
166  point_f operator +(const size_f& sz) const noexcept;
170  point_f operator +(const point& pt) const noexcept;
174  point_f operator +(const point_f& pt) const noexcept;
178  point_f& operator +=(const size& sz) noexcept;
182  point_f& operator +=(const size_f& sz) noexcept;
186  point_f& operator +=(const point& pt) noexcept;
190  point_f& operator +=(const point_f& pt) noexcept;
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;
210  point_f& operator -=(const size& sz) noexcept;
214  point_f& operator -=(const size_f& sz) noexcept;
218  point_f& operator -=(const point& pt) noexcept;
222  point_f& operator -=(const point_f& pt) noexcept;
224 
225  private:
226  float x_ = 0;
227  float y_ = 0;
228  };
229  }
230 }
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:40
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:53
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:30
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:51
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:1100
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition: point_f.h:34
Stores an ordered pair of floating-point, which specify a height and width.
Definition: size_f.h:29
Specifies that both the width and height property values of the control are defined.
Contains xtd::ustring class.
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:30
Specifies a printer&#39;s point (1/72 inch) as the unit of measure.