xtd 1.0.0
Loading...
Searching...
No Matches
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;
59
61
66 float x = .0f;
67
71 float y = .0f;
72
76 float width = .0f;
77
81 float height = .0f;
82
86 [[nodiscard]] auto bottom() const noexcept -> float;
87
90 [[nodiscard]] auto center() const noexcept -> xtd::drawing::point_f;
91
94 [[nodiscard]] auto is_empty() const noexcept -> bool;
95
98 [[nodiscard]] auto left() const noexcept -> float;
99
102 [[nodiscard]] auto location() const noexcept -> xtd::drawing::point_f;
105 auto location(const xtd::drawing::point_f& location) -> void;
106
109 [[nodiscard]] auto right() const noexcept -> float;
110
113 [[nodiscard]] auto size() const noexcept -> xtd::drawing::size_f;
116 auto size(const xtd::drawing::size_f& size) noexcept -> void;
117
120 [[nodiscard]] auto top() const noexcept -> float;
122
124
129 auto add(const xtd::drawing::size_f& sz) noexcept -> void;
134 auto add(float width, float height) noexcept -> void;
135
140 [[nodiscard]] auto contains(const xtd::drawing::point_f& pt) const noexcept -> bool;
145 [[nodiscard]] auto contains(const rectangle_f& rect) const noexcept -> bool;
151 [[nodiscard]] auto contains(float x, float y) const noexcept -> bool;
152
156 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
160 [[nodiscard]] auto equals(const rectangle_f& other) const noexcept -> bool override;
161
164 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
165
169 auto inflate(const xtd::drawing::size_f& sz) noexcept -> void;
175 auto inflate(float width, float height) noexcept -> void;
176
180 [[nodiscard]] auto intersects_with(const rectangle_f& rect) const noexcept -> bool;
181
184 auto make_intersect(const rectangle_f& rect) noexcept -> void;
185
188 auto make_union(const rectangle_f& rect) noexcept -> void;
189
193 auto offset(const xtd::drawing::point_f& pos) noexcept -> void;
197 auto offset(float dx, float dy) noexcept -> void;
198
201 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
203
205
213 [[nodiscard]] static auto add(const rectangle_f& rect, float x, float y) noexcept -> rectangle_f;
219 [[nodiscard]] static auto add(const rectangle_f& rect, const xtd::drawing::size_f& sz) noexcept -> rectangle_f;
220
228 [[nodiscard]] static auto from_ltrb(float left, float top, float right, float bottom) noexcept -> rectangle_f;
229
236 [[nodiscard]] static auto inflate(const rectangle_f& rect, const xtd::drawing::size_f& sz) noexcept -> rectangle_f;
242 [[nodiscard]] static auto inflate(const rectangle_f& rect, float width, float height) noexcept -> rectangle_f;
243
248 [[nodiscard]] static auto make_intersect(const rectangle_f& a, const rectangle_f& b) noexcept -> rectangle_f;
249
254 [[nodiscard]] static auto make_union(const rectangle_f& a, const rectangle_f& b) noexcept -> rectangle_f;
260 [[nodiscard]] static auto offset(const rectangle_f& rect, const xtd::drawing::point_f& pos) noexcept -> rectangle_f;
267 [[nodiscard]] static auto offset(const rectangle_f& rect, float x, float y) noexcept -> rectangle_f;
269 };
270 }
271}
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::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_f struct.
Contains xtd::drawing::size_f struct.
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:81
float width
Gets or sets the width of this xtd::drawing::rectangle_f structure.
Definition rectangle_f.hpp:76
rectangle_f() noexcept=default
Initializes a new instance of the xtd::drawing::rectagle_f class.
auto bottom() const noexcept -> float
Gets the y-coordinate that is the sum of the xtd::drawing::rectangle_f::y and xtd::drawing::rectangle...
auto location() const noexcept -> xtd::drawing::point_f
Gets the coordinates of the upper-left corner of this xtd::drawing::rectangle_f structure.
auto inflate(const xtd::drawing::size_f &sz) noexcept -> void
Enlarges this xtd::drawing::rectangle_f by the specified amount.
auto make_union(const rectangle_f &rect) noexcept -> void
Replaces this xtd::drawing::rectangle_f with the union of itself and the specified xtd::drawing::rect...
auto contains(const xtd::drawing::point_f &pt) const noexcept -> bool
Determines if the specified point is contained within this xtd::drawing::rectangle_f structure.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
auto left() const noexcept -> float
Gets the x-coordinate of the left edge of this xtd::drawing::rectangle_f structure.
auto top() const noexcept -> float
Gets the y-coordinate of the top edge of this xtd::drawing::rectangle_f structure.
auto right() const noexcept -> float
Gets the x-coordinate that is the sum of xtd::drawing::rectangle_f::x and xtd::drawing::rectangle_f::...
static auto from_ltrb(float left, float top, float right, float bottom) noexcept -> rectangle_f
Creates a xtd::drawing::rectangle_f structure with the specified edge locations.
auto make_intersect(const rectangle_f &rect) noexcept -> void
Replaces this xtd::drawing::rectangle_f with the intersection of itself and the specified xtd::drawin...
auto is_empty() const noexcept -> bool
Tests whether all numeric properties of this xtd::drawing::rectangle_f have values of zero.
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
auto size() const noexcept -> xtd::drawing::size_f
Gets the size of this xtd::drawing::rectangle_f.
auto add(const xtd::drawing::size_f &sz) noexcept -> void
Adds this xtd::drawing::rectangle_f by the specified amount.
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
float y
Gets or sets the y-coordinate of the upper-left corner of this xtd::drawing::rectangle_f structure.
Definition rectangle_f.hpp:71
auto intersects_with(const rectangle_f &rect) const noexcept -> bool
Determines if this rectangle intersects with rect.
float x
Gets or sets the x-coordinate of the upper-left corner of this xtd::drawing::rectangle_f structure.
Definition rectangle_f.hpp:66
auto offset(const xtd::drawing::point_f &pos) noexcept -> void
Adjusts the location of this rectangle by the specified amount.
auto to_string() const noexcept -> xtd::string override
Converts the attributes of this xtd::drawing::rectangle_f to a human-readable string.
auto center() const noexcept -> xtd::drawing::point_f
Gets the center property values of this xtd::drawing::rectangle structure.
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:32