xtd 0.2.0
rectangle_f.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "point_f.hpp"
7#include "size_f.hpp"
8#include <xtd/iequatable>
9#include <xtd/object>
10#include <xtd/string>
11#include <cstdint>
12#include <ostream>
13
15namespace xtd {
17 namespace drawing {
19 struct rectangle;
21
36
39 static const rectangle_f empty;
41
43
47 rectangle_f() noexcept = default;
53 rectangle_f(float x, float y, float width, float height) noexcept;
57 rectangle_f(const point_f& location, const size_f& size) noexcept;
59
61 rectangle_f(const rectangle_f&) noexcept = default;
62 rectangle_f& operator =(const rectangle_f&) noexcept = default;
64
66
71 float x = .0f;
72
76 float y = .0f;
77
81 float width = .0f;
82
86 float height = .0f;
87
91 float bottom() const noexcept;
92
95 point_f center() const noexcept;
96
99 bool is_empty() const noexcept;
100
103 float left() const noexcept;
104
107 point_f location() const noexcept;
111
114 float right() const noexcept;
115
118 size_f size() const noexcept;
121 void size(const size_f& size) noexcept;
122
125 float top() const noexcept;
127
129
134 void add(const drawing::size_f& sz) noexcept;
139 void add(float width, float height) noexcept;
140
145 bool contains(const point_f& pt) const noexcept;
150 bool contains(const rectangle_f& rect) const noexcept;
156 bool contains(float x, float y) const noexcept;
157
161 bool equals(const xtd::object& obj) const noexcept override;
165 bool equals(const rectangle_f& other) const noexcept override;
166
169 xtd::size get_hash_code() const noexcept override;
170
174 void inflate(const drawing::size_f& sz) noexcept;
180 void inflate(float width, float height) noexcept;
181
185 bool intersects_with(const rectangle_f& rect) const noexcept;
186
189 void make_intersect(const rectangle_f& rect) noexcept;
190
193 void make_union(const rectangle_f& rect) noexcept;
194
198 void offset(const point_f& pos) noexcept;
202 void offset(float dx, float dy) noexcept;
203
206 xtd::string to_string() const noexcept override;
208
210
218 static rectangle_f add(const rectangle_f& rect, float x, float y) noexcept;
224 static rectangle_f add(const rectangle_f& rect, const drawing::size_f& sz) noexcept;
225
233 static rectangle_f from_ltrb(float left, float top, float right, float bottom) noexcept;
234
241 static rectangle_f inflate(const rectangle_f& rect, const drawing::size_f& sz) noexcept;
247 static rectangle_f inflate(const rectangle_f& rect, float width, float height) noexcept;
248
253 static rectangle_f make_intersect(const rectangle_f& a, const rectangle_f& b) noexcept;
254
259 static rectangle_f make_union(const rectangle_f& a, const rectangle_f& b) noexcept;
265 static rectangle_f offset(const rectangle_f& rect, const point_f& pos) noexcept;
272 static rectangle_f offset(const rectangle_f& rect, float x, float y) noexcept;
274 };
275 }
276}
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
Contains drawing_export_ keyword.
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
@ other
The operating system is other.
Definition platform_id.hpp:58
@ a
The A key.
Definition console_key.hpp:88
@ f
The F key.
Definition console_key.hpp:98
@ b
The B key.
Definition console_key.hpp:90
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_f class.
Contains xtd::drawing::size_f class.
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.hpp:35
float height
Gets or sets the height of this xtd::drawing::rectangle_f structure. @pram height The height of this ...
Definition rectangle_f.hpp:86
float width
Gets or sets the width of this xtd::drawing::rectangle_f structure.
Definition rectangle_f.hpp:81
static rectangle_f from_ltrb(float left, float top, float right, float bottom) noexcept
Creates a xtd::drawing::rectangle_f structure with the specified edge locations.
bool is_empty() const noexcept
Tests whether all numeric properties of this xtd::drawing::rectangle_f have values of zero.
rectangle_f() noexcept=default
Initializes a new instance of the xtd::drawing::rectagle_f class.
void make_union(const rectangle_f &rect) noexcept
Replaces this xtd::drawing::rectangle_f with the union of itself and the specified xtd::drawing::rect...
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
void offset(const point_f &pos) noexcept
Adjusts the location of this rectangle by the specified amount.
float left() const noexcept
Gets the x-coordinate of the left edge of this xtd::drawing::rectangle_f structure.
bool equals(const xtd::object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
size_f size() const noexcept
Gets the size of this xtd::drawing::rectangle_f.
bool contains(const point_f &pt) const noexcept
Determines if the specified point is contained within this xtd::drawing::rectangle_f structure.
float top() const noexcept
Gets the y-coordinate of the top edge of this xtd::drawing::rectangle_f structure.
bool intersects_with(const rectangle_f &rect) const noexcept
Determines if this rectangle intersects with rect.
void inflate(const drawing::size_f &sz) noexcept
Enlarges this xtd::drawing::rectangle_f by the specified amount.
point_f center() const noexcept
Gets the center property values of this xtd::drawing::rectangle structure.
xtd::string to_string() const noexcept override
Converts the attributes of this xtd::drawing::rectangle_f to a human-readable string.
static const rectangle_f empty
Represents a xtd::drawing::rectangle_F that has xtd::drawing::rectagle_f::x, xtd::drawing::rectangle_...
Definition rectangle_f.hpp:39
point_f location() const noexcept
Gets the coordinates of the upper-left corner of this xtd::drawing::rectangle_f structure.
float y
Gets or sets the y-coordinate of the upper-left corner of this xtd::drawing::rectangle_f structure.
Definition rectangle_f.hpp:76
float bottom() const noexcept
Gets the y-coordinate that is the sum of the xtd::drawing::rectangle_f::y and xtd::drawing::rectangle...
float x
Gets or sets the x-coordinate of the upper-left corner of this xtd::drawing::rectangle_f structure.
Definition rectangle_f.hpp:71
float right() const noexcept
Gets the x-coordinate that is the sum of xtd::drawing::rectangle_f::x and xtd::drawing::rectangle_f::...
void make_intersect(const rectangle_f &rect) noexcept
Replaces this xtd::drawing::rectangle_f with the intersection of itself and the specified xtd::drawin...
void add(const drawing::size_f &sz) noexcept
Adds this xtd::drawing::rectangle_f by the specified amount.
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.hpp:44
Stores an ordered pair of floating-point, which specify a height and width.
Definition size_f.hpp:31