|
Pepper_42_C++_interfaces
|
#include <rect.h>

Public Member Functions | |
| Rect () | |
| Rect (const PP_Rect &rect) | |
| Rect (int32_t w, int32_t h) | |
| Rect (int32_t x, int32_t y, int32_t w, int32_t h) | |
| Rect (const Size &s) | |
| Rect (const Point &origin, const Size &size) | |
| ~Rect () | |
| Destructor. More... | |
| operator PP_Rect () const | |
| const PP_Rect & | pp_rect () const |
| PP_Rect & | pp_rect () |
| int32_t | x () const |
| void | set_x (int32_t in_x) |
| int32_t | y () const |
| void | set_y (int32_t in_y) |
| int32_t | width () const |
| void | set_width (int32_t w) |
| int32_t | height () const |
| void | set_height (int32_t h) |
| Point | point () const |
| void | set_point (const Point &origin) |
| Size | size () const |
| void | set_size (const Size &s) |
| int32_t | right () const |
| int32_t | bottom () const |
| void | SetRect (int32_t x, int32_t y, int32_t w, int32_t h) |
| void | SetRect (const PP_Rect &rect) |
| void | Inset (int32_t horizontal, int32_t vertical) |
| void | Inset (int32_t left, int32_t top, int32_t right, int32_t bottom) |
| void | Offset (int32_t horizontal, int32_t vertical) |
| void | Offset (const Point &point) |
| bool | IsEmpty () const |
| bool | Contains (int32_t point_x, int32_t point_y) const |
| bool | Contains (const Point &point) const |
| bool | Contains (const Rect &rect) const |
| bool | Intersects (const Rect &rect) const |
| Rect | Intersect (const Rect &rect) const |
| Rect | Union (const Rect &rect) const |
| Rect | Subtract (const Rect &rect) const |
| Rect | AdjustToFit (const Rect &rect) const |
| Point | CenterPoint () const |
| bool | SharesEdgeWith (const Rect &rect) const |
A 2 dimensional rectangle. A rectangle is represented by x and y (which identifies the upper-left corner of the rectangle), width, and height.
|
inline |
|
inline |
A constructor accepting a reference to a PP_Rect and converting the PP_Rect to a Rect. This is an implicit conversion constructor.
| [in] | rect | A PP_Rect. |
Definition at line 36 of file rect.h.
References set_height(), set_width(), set_x(), and set_y().
|
inline |
A constructor accepting two int32_t values for width and height and converting them to a Rect in the upper-left starting coordinate of 0,0.
| [in] | w | An int32_t value representing a width. |
| [in] | h | An int32_t value representing a height. |
Definition at line 49 of file rect.h.
References set_height(), set_width(), set_x(), and set_y().
|
inline |
A constructor accepting four int32_t values for width, height, x, and y.
| [in] | x | An int32_t value representing a horizontal coordinate of a point, starting with 0 as the left-most coordinate. |
| [in] | y | An int32_t value representing a vertical coordinate of a point, starting with 0 as the top-most coordinate. |
| [in] | w | An int32_t value representing a width. |
| [in] | h | An int32_t value representing a height. |
Definition at line 64 of file rect.h.
References set_height(), set_width(), set_x(), and set_y().
|
inlineexplicit |
A constructor accepting a pointer to a Point representing the origin of the rectangle and a pointer to a Size representing the height and width.
| [in] | origin | A pointer to a Point representing the upper-left starting coordinate. |
| [in] | size | A pointer to a Size representing the height and width. |
Definition at line 90 of file rect.h.
References set_point(), and set_size().
AdjustToFit() fits as much of the receiving rectangle within the supplied rectangle as possible, returning the result. For example, if the receiver had a x-location of 2 and a width of 4, and the supplied rectangle had an x-location of 0 with a width of 5, the returned rectangle would have an x-location of 1 with a width of 4.
| [in] | rect | A pointer to a Rect. |
Rect representing the difference between this rectangle and the receiving rectangle.
|
inline |
Getter function to get the upper-bound for the y-coordinates of the rectangle. Note that this coordinate value is one past the highest xy value of pixels in the rectangle. This loop will access all the pixels in a horizontal line in the rectangle: for (int32_t y = rect.y(); y < rect.bottom(); ++y) {}
| Point pp::Rect::CenterPoint | ( | ) | const |
CenterPoint() determines the center of this rectangle.
Point representing the center of this rectangle. | bool pp::Rect::Contains | ( | int32_t | point_x, |
| int32_t | point_y | ||
| ) | const |
Contains() determines if the point identified by point_x and point_y falls inside this rectangle. The point (x, y) is inside the rectangle, but the point (x + width, y + height) is not.
| [in] | point_x | An int32_t value representing a x value. |
| [in] | point_y | An int32_t value representing a y value. |
Referenced by Contains().
|
inline |
Contains() determines if the specified point is contained by this rectangle.
| [in] | point | A pointer to a Point representing a 2D coordinate. |
Definition at line 323 of file rect.h.
References Contains(), pp::Point::x(), and pp::Point::y().
| bool pp::Rect::Contains | ( | const Rect & | rect | ) | const |
Contains() determines if this rectangle contains the specified rectangle.
| [in] | rect | A pointer to a Rect. |
|
inline |
Getter function for returning the value of height.
Rect. Definition at line 171 of file rect.h.
Referenced by bottom(), and operator==().
|
inline |
| void pp::Rect::Inset | ( | int32_t | left, |
| int32_t | top, | ||
| int32_t | right, | ||
| int32_t | bottom | ||
| ) |
Inset() shrinks the rectangle by the specified amount on each side.
| [in] | left | An int32_t value representing a left shrinking distance. |
| [in] | top | An int32_t value representing a top shrinking distance. |
| [in] | right | An int32_t value representing a right shrinking distance. |
| [in] | bottom | An int32_t value representing a bottom shrinking distance. |
Intersect() computes the intersection of this rectangle with the given rectangle.
| [in] | rect | A pointer to a Rect. |
Rect representing the intersection. | bool pp::Rect::Intersects | ( | const Rect & | rect | ) | const |
Intersects() determines if this rectangle intersects the specified rectangle.
| [in] | rect | A pointer to a Rect. |
|
inline |
| void pp::Rect::Offset | ( | int32_t | horizontal, |
| int32_t | vertical | ||
| ) |
|
inline |
Offset() moves the rectangle by a horizontal and vertical distance.
| [in] | point | A pointer to a Point representing the horizontal and vertical move distances. |
Definition at line 295 of file rect.h.
References Offset(), pp::Point::x(), and pp::Point::y().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Getter function to get the upper-bound for the x-coordinates of the rectangle. Note that this coordinate value is one past the highest x value of pixels in the rectangle. This loop will access all the pixels in a horizontal line in the rectangle: for (int32_t x = rect.x(); x < rect.right(); ++x) {}
|
inline |
|
inline |
|
inline |
Setter function for setting the Size.
| [in] | s | A pointer to a Size representing the height and width. |
Definition at line 212 of file rect.h.
References pp::Size::height(), and pp::Size::width().
Referenced by Rect().
|
inline |
|
inline |
|
inline |
|
inline |
Setter function for setting the value of the Rect.
| [in] | x | A new x value. |
| [in] | y | A new y value. |
| [in] | w | A new width value. |
| [in] | h | A new height value. |
Definition at line 245 of file rect.h.
References set_height(), set_width(), set_x(), and set_y().
|
inline |
| bool pp::Rect::SharesEdgeWith | ( | const Rect & | rect | ) | const |
SharesEdgeWith() determines if this rectangle shares an entire edge (same width or same height) with the given rectangle, and the rectangles do not overlap.
| [in] | rect | A pointer to a Rect. |
|
inline |
Subtract() computes the rectangle resulting from subtracting rect from this Rect. If rectdoes not intersect completely in either the x or y direction, then *this is returned. If rect contains this, then an empty Rect is returned.
| [in] | rect | A pointer to a Rect. |
Rect representing the subtraction.
|
inline |
Getter function for returning the value of width.
Rect. Definition at line 153 of file rect.h.
Referenced by operator==(), and right().
|
inline |
Getter function for returning the value of x.
Point. Definition at line 125 of file rect.h.
Referenced by operator==(), and right().
|
inline |
Getter function for returning the value of y.
Point. Definition at line 139 of file rect.h.
Referenced by bottom(), and operator==().
1.8.6