10 #include "../drawing_export.h"
33 rectangle_f(
float x,
float y,
float width,
float height) : x_(
x), y_(
y), width_(width), height_(height) {}
39 bool operator==(
const rectangle_f& value)
const {
return x_ == value.x_ && y_ == value.y_ && width_ == value.width_ && height_ == value.height_;}
40 bool operator!=(
const rectangle_f& value)
const {
return !operator==(value);}
43 float bottom()
const {
return y_ + height_;}
45 float height()
const {
return height_;}
46 void height(
float height) {height_ = height;}
48 bool is_empty()
const {
return *
this == rectangle_f::empty;}
50 float left()
const {
return x_;}
51 void left(
float left) {x_ = left;}
53 point_f location()
const {
return {x_, y_};}
54 void location(
const point_f& location) {
59 float right()
const {
return x_ + width_;}
61 size_f size()
const {
return {width_, height_};}
67 float top()
const {
return y_;}
68 void top(
float top) {y_ = top;}
70 float x()
const {
return x_;}
71 void x(
float x) {x_ =
x;}
73 float y()
const {
return y_;}
74 void y(
float y) {y_ =
y;}
76 float width()
const {
return width_;}
77 void width(
float width) {width_ = width;}
79 bool contains(
float x,
float y)
const {
return x_ <=
x &&
x < x_ + width_ && y_ <=
y &&
y < y_ + height_;}
80 bool contains(
const point_f& pt)
const {
return contains(pt.x(), pt.y());}
81 bool contains(
const rectangle_f& rect)
const {
return x_ <= rect.x_ && (rect.x_ + rect.width_) <= (x_ + width_) && y_ <= rect.y_ && (rect.y_ + rect.height_) <= (y_ + height_);}
83 static rectangle_f from_ltrb(
float left,
float top,
float right,
float bottom) {
return rectangle_f(left, top, right - left, bottom - top);}
86 void inflate(
float width,
float height) {
93 result.inflate(width, height);
97 bool intersects_with(
const rectangle_f& rect)
const {
return (rect.x_ < x_ + width_) && (x_ < (rect.x_ + rect.width_)) && (rect.y_ < y_ + height_) && (y_ < rect.y_ + rect.height_);}
101 result.make_intersect(
b);
108 result.make_union(
b);
113 void offset(
const point_f& pt) {offset(pt.x(), pt.y());}
114 void offset(
float dx,
float dy) {
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition: point_f.h:26
Stores a set of four floating-points that represent the location and size of a rectangle.
Definition: rectangle_f.h:28
xtd::ustring to_string() const noexcept override
Returns a std::string that represents the current object.
Definition: rectangle_f.h:125
Stores a set of four integers that represent the location and size of a rectangle.
Definition: rectangle.h:25
xtd::ustring to_string() const noexcept override
Returns a std::string that represents the current object.
Definition: rectangle.h:129
Stores an ordered pair of floating-point, which specify a height and width.
Definition: size_f.h:24
float width() const
Gets the horizontal component of this Size class.
Definition: size_f.h:65
float height() const
Gets he vertical component of this Size Class.
Definition: size_f.h:55
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
int32_t width() const
Gets the horizontal component of this Size class.
Definition: size.h:67
int32_t height() const
Gets he vertical component of this Size Class.
Definition: size.h:57
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition: object.h:26
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
#define drawing_export_
Define shared library export.
Definition: drawing_export.h:13
std::string to_string(const value_t &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: to_string.h:37
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::object class.
Contains xtd::drawing::point_f class.
Contains xtd::drawing::size_f class.
Contains xtd::ustring class.