xtd 0.2.0
rectangle.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../drawing_export.hpp"
6#include "point.hpp"
7#include "size.hpp"
8#include "rectangle_f.hpp"
9#include <xtd/iequatable>
10#include <xtd/object>
11#include <xtd/string>
12#include <cstdint>
13#include <ostream>
14
16namespace xtd {
18 namespace drawing {
46
49 static const rectangle empty;
51
53
57 rectangle() noexcept = default;
63 rectangle(int32 x, int32 y, int32 width, int32 height) noexcept;
67 rectangle(const xtd::drawing::point& location, const xtd::drawing::size& size) noexcept;
69
71 rectangle(const rectangle&) noexcept = default;
72 rectangle& operator =(const rectangle&) noexcept = default;
73 operator rectangle_f() const noexcept;
75
77
82 int32 x = 0;
83
87 int32 y = 0;
88
92 int32 width = 0;
93
97 int32 height = 0;
98
102 int32 bottom() const noexcept;
103
106 point center() const noexcept;
107
110 bool is_empty() const noexcept;
111
114 int32 left() const noexcept;
115
118 xtd::drawing::point location() const noexcept;
121 void location(const xtd::drawing::point& value) noexcept;
122
125 int32 right() const noexcept;
126
129 xtd::drawing::size size() const noexcept;
132 void size(const xtd::drawing::size& value) noexcept;
133
136 int32 top() const noexcept;
138
140
145 void add(const drawing::size& sz) noexcept;
150 void add(int32 width, int32 height) noexcept;
151
156 bool contains(const xtd::drawing::point& pt) const noexcept;
161 bool contains(const xtd::drawing::rectangle& rect) const noexcept;
167 bool contains(int32 x, int32 y) const noexcept;
168
172 bool equals(const xtd::object& obj) const noexcept override;
176 bool equals(const rectangle& other) const noexcept override;
177
180 xtd::size get_hash_code() const noexcept override;
181
185 void inflate(const drawing::size& sz) noexcept;
191 void inflate(int32 width, int32 height) noexcept;
192
196 bool intersects_with(const rectangle& rect) const noexcept;
197
200 void make_intersect(const rectangle& rect) noexcept;
201
204 void make_union(const rectangle& rect) noexcept;
205
209 void offset(const point& pos) noexcept;
213 void offset(int32 dx, int32 dy) noexcept;
214
217 xtd::string to_string() const noexcept override;
219
221
229 static rectangle add(const rectangle& rect, int32 x, int32 y) noexcept;
235 static rectangle add(const rectangle& rect, const drawing::size& sz) noexcept;
236
240 static rectangle ceiling(const xtd::drawing::rectangle_f& rect) noexcept;
241
249 static rectangle from_ltrb(int32 left, int32 top, int32 right, int32 bottom) noexcept;
250
257 static rectangle inflate(const rectangle& rect, int32 x, int32 y) noexcept;
263 static rectangle inflate(const rectangle& rect, const drawing::size& sz) noexcept;
264
269 static rectangle make_intersect(const rectangle& a, const rectangle& b) noexcept;
270
275 static rectangle make_union(const rectangle& a, const rectangle& b) noexcept;
276
282 static rectangle offset(const rectangle& rect, const point& pos) noexcept;
289 static rectangle offset(const rectangle& rect, int32 x, int32 y) noexcept;
290
294 static rectangle round(const rectangle_f& rect) noexcept;
295
299 static rectangle truncate(const rectangle_f& rect) noexcept;
301 };
302 }
303}
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::drawing::point class.
Contains xtd::drawing::rectangle_f class.
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.hpp:54
Stores a set of four floating-point numbers that represent the location and size of a rectangle....
Definition rectangle_f.hpp:34
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.hpp: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.hpp:49
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:31
Contains xtd::drawing::size class.