xtd 0.2.0
Loading...
Searching...
No Matches
rectangle_f.h
Go to the documentation of this file.
1
4#pragma once
5#include "../drawing_export.h"
6#include "point_f.h"
7#include "size_f.h"
8#include <xtd/iequatable>
9#include <xtd/object>
10#include <xtd/ustring>
11#include <cstdint>
12#include <ostream>
13
15namespace xtd {
17 namespace drawing {
19 class rectangle;
21
34 class drawing_export_ rectangle_f : public xtd::object, public xtd::iequatable<rectangle_f> {
35 public:
37
40 static const rectangle_f empty;
42
44
48 rectangle_f() noexcept = default;
54 rectangle_f(float x, float y, float width, float height) noexcept;
58 rectangle_f(const point_f& location, const size_f& size) noexcept;
60
62 rectangle_f(const rectangle_f&) noexcept = default;
63 rectangle_f& operator =(const rectangle_f&) noexcept = default;
65
67
72 float bottom() const noexcept;
73
76 point_f center() const noexcept;
77
81 float height() const noexcept;
85 void height(float height) noexcept;
86
89 bool is_empty() const noexcept;
90
93 float left() const noexcept;
94
97 point_f location() const noexcept;
100 void location(const point_f& location);
101
104 float right() const noexcept;
105
108 size_f size() const noexcept;
111 void size(const size_f& size) noexcept;
112
115 float top() const noexcept;
116
120 float width() const noexcept;
124 void width(float width) noexcept;
125
129 float x() const noexcept;
133 void x(float x) noexcept;
134
138 float y() const noexcept;
142 void y(float y) noexcept;
144
146
151 void add(const drawing::size_f& sz) noexcept;
156 void add(float width, float height) noexcept;
157
162 bool contains(const point_f& pt) const noexcept;
167 bool contains(const rectangle_f& rect) const noexcept;
173 bool contains(float x, float y) const noexcept;
174
175 bool equals(const rectangle_f& value) const noexcept override;
176
180 void inflate(const drawing::size_f& sz) noexcept;
186 void inflate(float width, float height) noexcept;
187
191 bool intersects_with(const rectangle_f& rect) const noexcept;
192
195 void make_intersect(const rectangle_f& rect) noexcept;
196
199 void make_union(const rectangle_f& rect) noexcept;
200
204 void offset(const point_f& pos) noexcept;
208 void offset(float x, float y) noexcept;
209
212 xtd::ustring to_string() const noexcept override;
214
216
224 static rectangle_f add(const rectangle_f& rect, float x, float y) noexcept;
230 static rectangle_f add(const rectangle_f& rect, const drawing::size_f& sz) noexcept;
231
239 static rectangle_f from_ltrb(float left, float top, float right, float bottom) noexcept;
240
247 static rectangle_f inflate(const rectangle_f& rect, const drawing::size_f& sz) noexcept;
253 static rectangle_f inflate(const rectangle_f& rect, float width, float height) noexcept;
254
259 static rectangle_f make_intersect(const rectangle_f& a, const rectangle_f& b) noexcept;
260
265 static rectangle_f make_union(const rectangle_f& a, const rectangle_f& b) noexcept;
271 static rectangle_f offset(const rectangle_f& rect, const point_f& pos) noexcept;
278 static rectangle_f offset(const rectangle_f& rect, float x, float y) noexcept;
280
281 private:
282 float x_ = 0;
283 float y_ = 0;
284 float width_ = 0;
285 float height_ = 0;
286 };
287 }
288}
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 a set of four floating-point numbers that represent the location and size of a rectangle....
Definition rectangle_f.h:34
rectangle_f() noexcept=default
Initializes a new instance of the xtd::drawing::rectagle_f class.
static const rectangle_f empty
Represents a xtd::drawing::rectangle_F that has xtd::drawing::rectagle_f::x, xtd::drawing::rectangle_...
Definition rectangle_f.h:40
Stores an ordered pair of floating-point, which specify a height and width.
Definition size_f.h:31
Stores an ordered pair of integers, which specify a height and width.
Definition size.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
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
#define drawing_export_
Define shared library export.
Definition drawing_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::drawing::point_f class.
Contains xtd::drawing::size_f class.