Axis-aligned rectangle in DISCRETE (integer) coordinates. More...
#include <geometry.hpp>
Public Member Functions | |
| constexpr int | right () const |
| constexpr int | bottom () const |
| constexpr int | center_x () const |
| Integer center. | |
| constexpr int | center_y () const |
| constexpr bool | is_empty () const |
| constexpr bool | contains (int px, int py) const |
| constexpr bool | contains (const IntRect &r) const |
| IntRect | reduced (int d) const |
| IntRect | reduced (int dx, int dy) const |
| IntRect | expanded (int d) const |
| IntRect | expanded (int dx, int dy) const |
| constexpr IntRect | translated (int dx, int dy) const |
| constexpr IntRect | with_x (int v) const |
| constexpr IntRect | with_y (int v) const |
| constexpr IntRect | with_width (int v) const |
| constexpr IntRect | with_height (int v) const |
| constexpr IntRect | with_size (int w, int h) const |
| constexpr IntRect | with_position (int nx, int ny) const |
| constexpr IntRect | with_size_keeping_center (int w, int h) const |
| Resize about the center, in integer arithmetic. | |
| IntRect | remove_from_top (int amount) |
| IntRect | remove_from_bottom (int amount) |
| IntRect | remove_from_left (int amount) |
| IntRect | remove_from_right (int amount) |
| constexpr bool | intersects (const IntRect &o) const |
| IntRect | intersection (const IntRect &o) const |
| IntRect | union_with (const IntRect &o) const |
| constexpr Rect | to_float () const |
| Widening conversion — always exact. | |
| constexpr bool | operator== (const IntRect &r) const |
| constexpr bool | operator!= (const IntRect &r) const |
Public Attributes | |
| int | x = 0 |
| int | y = 0 |
| int | width = 0 |
| int | height = 0 |
Axis-aligned rectangle in DISCRETE (integer) coordinates.
Every operation here uses integer arithmetic — most importantly, the center is an integer division and therefore truncates. See the note on Rect.
|
inlineconstexpr |
|
inlineconstexpr |
Integer center.
IntRect{0,0,7,7}.center_x() == 3, NOT 3.5 — the half pixel is truncated away, and that is the whole point of this type.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
|
inline |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineconstexpr |
|
inlineconstexpr |
Widening conversion — always exact.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
| int pulp::view::IntRect::height = 0 |
| int pulp::view::IntRect::width = 0 |
| int pulp::view::IntRect::x = 0 |
| int pulp::view::IntRect::y = 0 |