8 static const char *
const TAG =
"display";
11 if (this->
is_set() && (this->
w >= (-2 * horizontal)) && (this->
h >= (-2 * vertical))) {
12 this->
x = this->
x - horizontal;
13 this->
y = this->
y - vertical;
14 this->
w = this->
w + (2 * horizontal);
15 this->
h = this->h + (2 * vertical);
26 if (this->
x > rect.
x) {
27 this->
w = this->
w + (this->
x - rect.
x);
30 if (this->
y > rect.
y) {
31 this->
h = this->
h + (this->
y - rect.
y);
34 if (this->
x2() < rect.
x2()) {
35 this->
w = rect.
x2() - this->
x;
37 if (this->
y2() < rect.
y2()) {
38 this->
h = rect.
y2() - this->
y;
46 if (this->
x2() > rect.
x2()) {
47 this->
w = rect.
x2() - this->
x;
49 if (this->
x < rect.
x) {
50 this->
w = this->
w + (this->
x - rect.
x);
53 if (this->
y2() > rect.
y2()) {
54 this->
h = rect.
y2() - this->
y;
56 if (this->
y < rect.
y) {
57 this->
h = this->
h + (this->
y - rect.
y);
64 return (rect.
x == this->x) && (rect.
w == this->
w) && (rect.
y == this->y) && (rect.
h == this->
h);
67 bool Rect::inside(int16_t test_x, int16_t test_y,
bool absolute)
const {
72 return ((test_x >= this->
x) && (test_x <= this->
x2()) && (test_y >= this->
y) && (test_y <= this->
y2()));
74 return ((test_x >= 0) && (test_x <= this->
w) && (test_y >= 0) && (test_y <= this->
h));
83 return ((rect.
x <= this->x2()) && (rect.
x2() >= this->
x) && (rect.
y <= this->y2()) && (rect.
y2() >= this->
y));
85 return ((rect.
x <= this->w) && (rect.
w >= 0) && (rect.
y <= this->h) && (rect.
h >= 0));
91 ESP_LOGI(TAG,
"%s [%3d,%3d,%3d,%3d] (%3d,%3d)", prefix.c_str(), this->
x, this->
y, this->
w, this->
h, this->
x2(),
94 ESP_LOGI(TAG,
"%s ** IS NOT SET **", prefix.c_str());
bool is_set() const ESPHOME_ALWAYS_INLINE
Y coordinate of corner.
bool inside(Rect rect, bool absolute=true) const
int16_t x
X coordinate of corner.
int16_t h
Height of region.
int16_t y
Y coordinate of corner.
bool equal(Rect rect) const
void info(const std::string &prefix="rect info:")
Implementation of SPI Controller mode.
void expand(int16_t horizontal, int16_t vertical)
int16_t y2() const
X coordinate of corner.
int16_t w
Width of region.