xtd 0.2.0
Loading...
Searching...
No Matches
rectangle.h
Go to the documentation of this file.
1
4#pragma once
5#include "../drawing_export.h"
6#include "point.h"
7#include "size.h"
8#include "rectangle_f.h"
9#include <xtd/iequatable>
10#include <xtd/object>
11#include <xtd/ustring>
12#include <cstdint>
13#include <ostream>
14
16namespace xtd {
18 namespace drawing {
44 class drawing_export_ rectangle : public xtd::object, public xtd::iequatable<rectangle> {
45 public:
47
50 static const rectangle empty;
52
54
58 rectangle() noexcept = default;
64 rectangle(int32 x, int32 y, int32 width, int32 height) noexcept;
68 rectangle(const xtd::drawing::point& location, const xtd::drawing::size& size) noexcept;
70
72 rectangle(const rectangle&) noexcept = default;
73 rectangle& operator =(const rectangle&) noexcept = default;
74 operator rectangle_f() const noexcept;
76
78
83 int32 bottom() const noexcept;
84
87 point center() const noexcept;
88
92 int32 height() const noexcept;
96 void height(int32 value) noexcept;
97
100 bool is_empty() const noexcept;
101
104 int32 left() const noexcept;
105
108 xtd::drawing::point location() const noexcept;
111 void location(const xtd::drawing::point& value) noexcept;
112
115 int32 right() const noexcept;
116
119 xtd::drawing::size size() const noexcept;
122 void size(const xtd::drawing::size& value) noexcept;
123
126 int32 top() const noexcept;
127
131 int32 width() const noexcept;
135 void width(int32 value) noexcept;
136
140 int32 x() const noexcept;
144 void x(int32 value) noexcept;
145
149 int32 y() const noexcept;
153 void y(int32 value) noexcept;
155
157
162 void add(const drawing::size& sz) noexcept;
167 void add(int32 width, int32 height) noexcept;
168
173 bool contains(const xtd::drawing::point& pt) const noexcept;
178 bool contains(const xtd::drawing::rectangle& rect) const noexcept;
184 bool contains(int32 x, int32 y) const noexcept;
185
186 bool equals(const rectangle& value) const noexcept override;
187
191 bool intersects_with(const rectangle& rect) const noexcept;
192
195 void make_intersect(const rectangle& rect) noexcept;
196
199 void make_union(const rectangle& rect) noexcept;
200
204 void offset(const point& pos) noexcept;
208 void offset(int32 x, int32 y) noexcept;
209
212 xtd::ustring to_string() const noexcept override;
214
218 void inflate(const drawing::size& sz) noexcept;
224 void inflate(int32 width, int32 height) noexcept;
225
227
235 static rectangle add(const rectangle& rect, int32 x, int32 y) noexcept;
241 static rectangle add(const rectangle& rect, const drawing::size& sz) noexcept;
242
246 static rectangle ceiling(const xtd::drawing::rectangle_f& rect) noexcept;
247
255 static rectangle from_ltrb(int32 left, int32 top, int32 right, int32 bottom) noexcept;
256
263 static rectangle inflate(const rectangle& rect, int32 x, int32 y) noexcept;
269 static rectangle inflate(const rectangle& rect, const drawing::size& sz) noexcept;
270
275 static rectangle make_intersect(const rectangle& a, const rectangle& b) noexcept;
276
281 static rectangle make_union(const rectangle& a, const rectangle& b) noexcept;
282
288 static rectangle offset(const rectangle& rect, const point& pos) noexcept;
295 static rectangle offset(const rectangle& rect, int32 x, int32 y) noexcept;
296
300 static rectangle round(const rectangle_f& rect) noexcept;
301
305 static rectangle truncate(const rectangle_f& rect) noexcept;
307
308 private:
309 int32 x_ = 0;
310 int32 y_ = 0;
311 int32 width_ = 0;
312 int32 height_ = 0;
313 };
314 }
315}
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.h:54
Stores a set of four floating-point numbers that represent the location and size of a rectangle....
Definition rectangle_f.h:34
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.h:44
rectangle() noexcept=default
Initializes a new instance of the xtd::drawing::rectangle class.
static const rectangle empty
Represents a xtd::drawing::rectangle that has xtd::drawing::rectagle::x, xtd::drawing::rectangle::y,...
Definition rectangle.h:50
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
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::drawing::point class.
Contains xtd::drawing::rectangle_f class.
Contains xtd::drawing::size class.