xtd 1.0.0
Loading...
Searching...
No Matches
rectangle.hpp
Go to the documentation of this file.
1
4#pragma once
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;
67 rectangle(const xtd::drawing::point& location, const xtd::drawing::size& size) noexcept;
69
71 operator xtd::drawing::rectangle_f() const noexcept;
73
75
80 xtd::int32 x = 0;
81
85 xtd::int32 y = 0;
86
91
96
100 [[nodiscard]] auto bottom() const noexcept -> xtd::int32;
101
104 [[nodiscard]] auto center() const noexcept -> xtd::drawing::point;
105
108 [[nodiscard]] bool is_empty() const noexcept;
109
112 [[nodiscard]] auto left() const noexcept -> xtd::int32;
113
116 [[nodiscard]] auto location() const noexcept -> xtd::drawing::point;
119 auto location(const xtd::drawing::point& value) noexcept -> void;
120
123 [[nodiscard]] auto right() const noexcept -> xtd::int32;
124
127 auto size() const noexcept -> xtd::drawing::size;
130 auto size(const xtd::drawing::size& value) noexcept -> void;
131
134 [[nodiscard]] auto top() const noexcept -> xtd::int32;
136
138
143 auto add(const xtd::drawing::size& sz) noexcept -> void;
148 auto add(xtd::int32 width, xtd::int32 height) noexcept -> void;
149
154 [[nodiscard]] auto contains(const xtd::drawing::point& pt) const noexcept -> bool;
159 [[nodiscard]] auto contains(const xtd::drawing::rectangle& rect) const noexcept -> bool;
165 [[nodiscard]] auto contains(xtd::int32 x, xtd::int32 y) const noexcept -> bool;
166
170 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
174 [[nodiscard]] auto equals(const rectangle& other) const noexcept -> bool override;
175
178 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
179
183 auto inflate(const xtd::drawing::size& sz) noexcept -> void;
189 auto inflate(xtd::int32 width, xtd::int32 height) noexcept -> void;
190
194 [[nodiscard]] auto intersects_with(const rectangle& rect) const noexcept -> bool;
195
198 auto make_intersect(const rectangle& rect) noexcept -> void;
199
202 auto make_union(const rectangle& rect) noexcept -> void;
203
207 auto offset(const xtd::drawing::point& pos) noexcept -> void;
211 auto offset(xtd::int32 dx, xtd::int32 dy) noexcept -> void;
212
215 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
217
219
227 [[nodiscard]] static auto add(const rectangle& rect, xtd::int32 x, xtd::int32 y) noexcept -> rectangle;
233 [[nodiscard]] static auto add(const rectangle& rect, const xtd::drawing::size& sz) noexcept -> rectangle;
234
238 [[nodiscard]] static auto ceiling(const xtd::drawing::rectangle_f& rect) noexcept -> rectangle;
239
247 [[nodiscard]] static auto from_ltrb(xtd::int32 left, xtd::int32 top, xtd::int32 right, xtd::int32 bottom) noexcept -> rectangle;
248
255 [[nodiscard]] static auto inflate(const rectangle& rect, xtd::int32 x, xtd::int32 y) noexcept -> rectangle;
261 [[nodiscard]] static auto inflate(const rectangle& rect, const xtd::drawing::size& sz) noexcept -> rectangle;
262
267 [[nodiscard]] static auto make_intersect(const rectangle& a, const rectangle& b) noexcept -> rectangle;
268
273 [[nodiscard]] static auto make_union(const rectangle& a, const rectangle& b) noexcept -> rectangle;
274
280 [[nodiscard]] static auto offset(const rectangle& rect, const xtd::drawing::point& pos) noexcept -> rectangle;
287 [[nodiscard]] static auto offset(const rectangle& rect, xtd::int32 x, xtd::int32 y) noexcept -> rectangle;
288
292 [[nodiscard]] static auto round(const rectangle_f& rect) noexcept -> rectangle;
293
297 [[nodiscard]] static auto truncate(const xtd::drawing::rectangle_f& rect) noexcept -> rectangle;
299 };
300 }
301}
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Contains drawing_export_ keyword.
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::drawing::point struct.
Contains xtd::drawing::rectangle_f struct.
Contains xtd::drawing::size struct.
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
auto contains(const xtd::drawing::point &pt) const noexcept -> bool
Determines if the specified point is contained within this xtd::drawing::rectangle structure.
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto right() const noexcept -> xtd::int32
Gets the x-coordinate that is the sum of xtd::drawing::rectangle::x and xtd::drawing::rectangle::widt...
auto center() const noexcept -> xtd::drawing::point
Gets the center property values of this xtd::drawing::rectangle structure.
auto inflate(const xtd::drawing::size &sz) noexcept -> void
Enlarges this xtd::drawing::rectangle by the specified amount.
auto size() const noexcept -> xtd::drawing::size
Gets the size of this xtd::drawing::rectangle.
xtd::int32 height
Gets or sets the height of this xtd::drawing::rectangle structure.
Definition rectangle.hpp:95
auto make_intersect(const rectangle &rect) noexcept -> void
Replaces this xtd::drawing::rectangle with the intersection of itself and the specified xtd::drawing:...
auto top() const noexcept -> xtd::int32
Gets the y-coordinate of the top edge of this xtd::drawing::rectangle structure.
rectangle() noexcept=default
Initializes a new instance of the xtd::drawing::rectangle class.
static auto round(const rectangle_f &rect) noexcept -> rectangle
Converts the specified xtd::drawing::rectangle_f to a xtd::drawing::rectangle by rounding the xtd::dr...
auto intersects_with(const rectangle &rect) const noexcept -> bool
Determines if this rectangle intersects with rect.
auto add(const xtd::drawing::size &sz) noexcept -> void
Adds this xtd::drawing::rectangle by the specified amount.
auto bottom() const noexcept -> xtd::int32
Gets the y-coordinate that is the sum of the xtd::drawing::rectangle::y and xtd::drawing::rectangle::...
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
auto to_string() const noexcept -> xtd::string override
Converts the attributes of this xtd::drawing::rectangle to a human-readable string.
xtd::int32 width
Gets or sets the width of this xtd::drawing::rectangle structure.
Definition rectangle.hpp:90
auto offset(const xtd::drawing::point &pos) noexcept -> void
Adjusts the location of this rectangle by the specified amount.
bool is_empty() const noexcept
Tests whether all numeric properties of this xtd::drawing::rectangle have values of zero.
xtd::int32 x
Gets or sets the x-coordinate of the upper-left corner of this xtd::drawing::rectangle structure....
Definition rectangle.hpp:80
static const rectangle empty
Represents a xtd::drawing::rectangle that has xtd::drawing::rectagle::x, xtd::drawing::rectangle::y,...
Definition rectangle.hpp:49
static auto from_ltrb(xtd::int32 left, xtd::int32 top, xtd::int32 right, xtd::int32 bottom) noexcept -> rectangle
Creates a xtd::drawing::rectangle structure with the specified edge locations.
static auto ceiling(const xtd::drawing::rectangle_f &rect) noexcept -> rectangle
Converts the specified xtd::drawing::rectangle_f structure to a xtd::drawing::rectangle structure by ...
auto make_union(const rectangle &rect) noexcept -> void
Replaces this xtd::drawing::rectangle with the union of itself and the specified xtd::drawing::rectan...
auto left() const noexcept -> xtd::int32
Gets the x-coordinate of the left edge of this xtd::drawing::rectangle structure.
xtd::int32 y
Gets or sets the y-coordinate of the upper-left corner of this xtd::drawing::rectangle structure.
Definition rectangle.hpp:85
auto location() const noexcept -> xtd::drawing::point
Gets the coordinates of the upper-left corner of this xtd::drawing::rectangle structure.
static auto truncate(const xtd::drawing::rectangle_f &rect) noexcept -> rectangle
Converts the specified xtd::drawing::rectangle_f to a xtd::drawing::rectangle by truncating the xtd::...