|
| RectI () |
| Default constructor for creating empty rectangle.
|
|
| RectI (const PointI &topleft, const PointI &bottomright) |
| Special rectangle constructor with setting the top-left and bottom-right angle.
|
|
| RectI (const PointI &topleft, const SizeI &size) |
| Special rectangle constructor with setting top-left angle coordinates and rectangle size.
|
|
| RectI (int left, int top, int width, int height) |
| Special rectangle constructor with setting top-left angle coordinates and rectangle size.
|
|
void | Init (int x, int y, int w, int h) |
| Initializes the rectangle with setting top-left angle coordinates and rectangle size.
|
|
void | InitCoords (int x1, int y1, int x2, int y2) |
| Initializes the rectangle with setting top-left angle coordinates and rectangle size.
|
|
bool | IsNull () const |
| True if rectangle is empty. More...
|
|
bool | IsEmpty () const |
| True if rectangle is empty. More...
|
|
bool | IsValid () const |
| True if rectangle is valid. More...
|
|
int | GetLeft () const |
| Returns X-coordinate of the left rectangle edge. It is the equivalent of GetX() function. More...
|
|
int | GetTop () const |
| Returns Y-coordinate of the left rectangle edge. It is the equivalent of GetY() function. More...
|
|
int | GetRight () const |
| Returns X-coordinate of the right rectangle edge. More...
|
|
int | GetBottom () const |
| Returns Y-coordinate of the bottom rectangle edge. More...
|
|
RectI | Normalized () const |
| Returns normalized rectangle, i.e. the rectangle has no negative width and height. More...
|
|
int | GetX () const |
| Returns X-coordinate of the left rectangle edge. It is the equivalent of GetLeft() function. More...
|
|
int | GetY () const |
| Returns Y-coordinate of the top rectangle edge. It is the equivalent of GetTop() function. More...
|
|
void | SetLeft (int left) |
| Sets the left rectangle edge to the given X-coordinate. Changes width, but it does not change coordinate of the right rectangle edge. It is the equivalent of SetX() function.
|
|
void | SetTop (int top) |
| Sets the top rectangle edge to the given Y-coordinate. Changes height, but it does not change coordinate of the bottom rectangle edge. It is the equivalent of SetY() function.
|
|
void | SetRight (int right) |
| Sets the right rectangle edge to the given X-coordinate. Changes width, but it does not change coordinate of the left rectangle edge.
|
|
void | SetBottom (int bottom) |
| Sets the bottom rectangle edge to the given Y-coordinate. Changes height, but it does not change coordinate of the top rectangle edge.
|
|
void | SetX (int x) |
| Sets the left rectangle edge to the given X-coordinate. Changes width, but it does not change coordinate of the right rectangle edge. It is the equivalent of SetLeft() function.
|
|
void | SetY (int y) |
| Sets the top rectangle edge to the given Y-coordinate. Changes height, but it does not change coordinate of the bottom rectangle edge. It is the equivalent of SetTop() function.
|
|
void | SetTopLeft (const PointI &p) |
| Sets the top-left rectangle angle to the given position. Changes size, but it does not change the bottom-right rectangle angle.
|
|
void | SetBottomRight (const PointI &p) |
| Sets the bottom-right rectangle angle to the given position. Changes size, but it does not change the top-left rectangle angle.
|
|
void | SetTopRight (const PointI &p) |
| Sets the top-right rectangle angle to the given position. Changes size, but it does not change the bottom-left rectangle angle.
|
|
void | SetBottomLeft (const PointI &p) |
| Sets the bottom-left rectangle angle to the given position. Changes size, but it does not change the top-right rectangle angle.
|
|
PointI | GetTopLeft () const |
| Returns position of the top-left rectangle angle. More...
|
|
PointI | GetBottomRight () const |
| Returns position of the bottom-right rectangle angle. More...
|
|
PointI | GetTopRight () const |
| Returns position of the top-right rectangle angle. More...
|
|
PointI | GetBottomLeft () const |
| Returns position of the bottom-left rectangle angle. More...
|
|
PointI | GetCenter () const |
| Returns the rectangle center point. More...
|
|
void | Offset (int dx, int dy) |
| Moves the rectangle on "dx" value along X-axis and "dy" value along Y-axis. It is all about the current position.
|
|
void | Offset (const PointI &p) |
| Overloaded function. It moves the rectangle p.GetX() along X-axis and p.GetY() along Y-axis, all about the current position.
|
|
RectI | Offseted (int dx, int dy) const |
| Returns copy of the rectangle that is moved on "dx" value along X-axis and "dy" value along Y-axis, all about the current position. All positive values move the rectangle to right and down. More...
|
|
RectI | Offseted (const PointI &p) const |
| Overloaded function. It returns copy of the rectangle that is moved p.GetX() along X-axis and p.GetY() along Y-axis, all about the current position. Positive values move the rectangle to right and down. More...
|
|
void | MoveToXY (int x, int t) |
| Moves the rectangle by shifting the top-left angle at the defined position (х, у). Rectangle size is not changed.
|
|
void | MoveToXY (const PointI &p) |
| Moves the rectangle by shifting the top-left angle at the defined position.
|
|
void | Inflate (int x1, int y1, int x2, int y2) |
| Adds x1, y1, x2, and y2 values to existing rectangle coordinates.
|
|
RectI | Inflated (int x1, int y1, int x2, int y2) const |
| Returns new rectangle with x1, y1, x2, and y2 values, added to existing rectangle coordinates. More...
|
|
SizeI | GetSize () const |
| Returns rectangle size. More...
|
|
int | GetWidth () const |
| Returns rectangle width. More...
|
|
int | GetHeight () const |
| Returns rectangle height. More...
|
|
void | SetWidth (int w) |
| Sets the defined width for the rectangle by changing its right edge. The left rectangle edge is not changed.
|
|
void | SetHeight (int h) |
| Sets the defined height for the rectangle by changing its bottom edge. Top edge is not changed.
|
|
void | SetSize (const SizeI &s) |
| Sets the new size for the rectangle. Top-left angle is not moved.
|
|
RectI | operator| (const RectI &other) const |
| Returns bounding rectangle of the given rectangle and the defined rectangle. More...
|
|
RectI | operator& (const RectI &other) const |
| Returns intersection of the given rectangle and the defined rectangle. It returns empty rectangle if no intersection. More...
|
|
RectI & | operator|= (const RectI &other) |
| Union of the given rectangle with the defined rectangle.
|
|
RectI & | operator&= (const RectI &other) |
| Intersection of the given rectangle with the defined rectangle.
|
|
bool | RectInRect (const RectI &other, bool proper=false) const |
| Overloaded function. True if the defined rectangle is inside the given rectangle. True if the defined rectangle is wholly inside the given rectangle, not on the edge. More...
|
|
bool | PntInRect (const PointI &p, bool proper=false) const |
| True if the given point is inside the rectangle or on the edge. True if the given point is inside the rectangle, i.e. not on the edge. More...
|
|
bool | PntInRect (int x, int y) const |
| Overloaded function. True if point (х, у) is inside the rectangle. More...
|
|
bool | PntInRect (int x, int y, bool proper) const |
| Overloaded function. True if the given point (x, y) is inside the rectangle or on the edge. True if the given point (x, y) is inside the rectangle, i.e. not on the edge. More...
|
|
RectI | United (const RectI &other) const |
| Returns bounding rectangle of the given rectangle and the defined rectangle. More...
|
|
RectI | Intersected (const RectI &other) const |
| Returns intersection of the given rectangle and the defined rectangle. More...
|
|
bool | Intersects (const RectI &r) const |
| True if the given rectangle intersects with the defined rectangle. It means that at least one pixel, inside both rectangles, exists. More...
|
|
bool | operator== (const RectI &) |
| True if the given rectangle is equal to the specified rectangle. More...
|
|
bool | operator!= (const RectI &) |
| True if the given rectangle is different from the specified rectangle. More...
|
|
RectI class defines rectangle in the plane using integer precision.
Rectangle is typically expressed as top-left angle and size. Rectangle can be constructed with integer coordinates of left, top, width and height, or with PointI and SizeI classes. RectI class provides a set of functions that return necessary coordinates of the rectangle and allow initializing them. RectI class also provides functions for moving the rectangle about its coordinates, etc.