53 return p2.
x - p1.
x + 1;
65 return {(p2.
x + p1.
x) / 2, (p2.
y + p1.
y) / 2};
71 return p2.
y - p1.
y + 1;
129 if ( p1.
x < rect.
p1.
x )
131 if ( p1.
y < rect.
p1.
y )
133 if ( p2.
x > rect.
p2.
x )
135 if ( p2.
y > rect.
p2.
y )
145 return (x >= p1.
x) && (x <= p2.
x);
154 return (y >= p1.
y) && (y <= p2.
y);
220 return {{
static_cast<lcdint_t>(p1.
x - p.
x), static_cast<lcdint_t>(p1.
y - p.
y)},
221 {
static_cast<lcdint_t>(p2.
x - p.
x), static_cast<lcdint_t>(p2.
y - p.
y)}};
230 return {{
static_cast<lcdint_t>(p1.
x + p.
x), static_cast<lcdint_t>(p1.
y + p.
y)},
231 {
static_cast<lcdint_t>(p2.
x + p.
x), static_cast<lcdint_t>(p2.
y + p.
y)}};
253 return {p1 >> bits, p2 >> bits};
262 return {p1 << bits, p2 << bits};
267 #ifndef DOXYGEN_SHOULD_SKIP_THIS void crop(const _NanoRect &rect)
Crops rectangle to fit specified area.
_NanoRect operator-(const _NanoPoint &p)
Returns true if specified point is above rectangle area.
_NanoRect operator+(const _NanoPoint &p)
Add point to all points of rectangle.
bool collisionY(lcdint_t y) const
Returns true if specified y position is between left and right borders.
NanoRect structure describes rectangle area.
lcdint_t height() const
returns height of NanoRect
void addV(lcdint_t dy)
Shifts rectangle area by dy pixels.
NanoPoint p2
right-bottom point of the rectangle area
int8_t lcdint_t
internal int type, used by the library.
_NanoRect operator<<(const uint8_t bits) const
Shifts left x,y value of the point by bits value.
bool above(const NanoPoint &p) const
Returns true if specified point is above rectangle area.
const NanoPoint center() const
returns center point of NanoRect
lcdint_t y
y position in pixels
bool collision(const NanoPoint &p) const
Returns true if specified point is inside rectangle area.
Basic structures of canvas gfx library.
_NanoRect operator>>(const uint8_t bits) const
Shifts right x,y value of the point by bits value.
struct _NanoRect NanoRect
NanoRect structure describes rectangle area.
bool contains(const NanoPoint &p) const
Returns true of point belongs to rectangle area.
void setRect(lcdint_t l, lcdint_t t, lcdint_t r, lcdint_t b)
Initializes NanoRect with specified values.
_NanoRect & operator+=(const _NanoPoint &p)
Subtracts point to all points of rectangle.
void addH(lcdint_t dx)
Shifts rectangle area by dx pixels.
bool below(const NanoPoint &p) const
Returns true if specified point is below rectangle area.
bool collisionX(lcdint_t x) const
Returns true if specified x position is between left and right borders.
void move(lcdint_t dx, lcdint_t dy)
Shifts rectangle area by dx;dy pixels.
lcdint_t width() const
returns width of NanoRect
const NanoPoint size() const
returns size of NanoRect
bool contains(const _NanoRect &r) const
Returns true if whole rectangle belongs to rectangle area.
bool containsPartOf(const _NanoRect &r) const
Returns true if rectangle topleft or rightbottom points belong to rectangle area. ...
NanoPoint p1
top-left point of the rectangle area
lcdint_t x
x position in pixels