Pepper_42_C++_interfaces
|
#include <rect.h>
Public Member Functions | |
FloatRect () | |
FloatRect (const PP_FloatRect &rect) | |
FloatRect (float w, float h) | |
FloatRect (float x, float y, float w, float h) | |
FloatRect (const FloatSize &s) | |
FloatRect (const FloatPoint &origin, const FloatSize &size) | |
~FloatRect () | |
Destructor. More... | |
operator PP_FloatRect () const | |
const PP_FloatRect & | pp_float_rect () const |
PP_FloatRect & | pp_float_rect () |
float | x () const |
void | set_x (float in_x) |
float | y () const |
void | set_y (float in_y) |
float | width () const |
void | set_width (float w) |
float | height () const |
void | set_height (float h) |
FloatPoint | point () const |
void | set_point (const FloatPoint &origin) |
FloatSize | Floatsize () const |
void | set_size (const FloatSize &s) |
float | right () const |
float | bottom () const |
void | SetRect (float x, float y, float w, float h) |
void | SetRect (const PP_FloatRect &rect) |
void | Inset (float horizontal, float vertical) |
void | Inset (float left, float top, float right, float bottom) |
void | Offset (float horizontal, float vertical) |
void | Offset (const FloatPoint &point) |
bool | IsEmpty () const |
bool | Contains (float point_x, float point_y) const |
bool | Contains (const FloatPoint &point) const |
bool | Contains (const FloatRect &rect) const |
bool | Intersects (const FloatRect &rect) const |
FloatRect | Intersect (const FloatRect &rect) const |
FloatRect | Union (const FloatRect &rect) const |
FloatRect | Subtract (const FloatRect &rect) const |
FloatRect | AdjustToFit (const FloatRect &rect) const |
FloatPoint | CenterPoint () const |
bool | SharesEdgeWith (const FloatRect &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_FloatRect and
converting the PP_FloatRect
to a FloatRect
. This is an implicit conversion constructor.
[in] | rect | A PP_FloatRect . |
Definition at line 418 of file rect.h.
References set_height(), set_width(), set_x(), and set_y().
|
inline |
A constructor accepting two float values for width and height and converting them to a FloatRect
in the upper-left starting coordinate of 0.0f, 0.0f.
[in] | w | An float value representing a width. |
[in] | h | An float value representing a height. |
Definition at line 431 of file rect.h.
References set_height(), set_width(), set_x(), and set_y().
|
inline |
A constructor accepting four float values for width, height, x, and y.
[in] | x | An float value representing a horizontal coordinate of a point, starting with 0.0f as the left-most coordinate. |
[in] | y | An float value representing a vertical coordinate of a point, starting with 0.0f as the top-most coordinate. |
[in] | w | An float value representing a width. |
[in] | h | An float value representing a height. |
Definition at line 446 of file rect.h.
References set_height(), set_width(), set_x(), and set_y().
|
inlineexplicit |
|
inline |
A constructor accepting a pointer to a FloatPoint
representing the origin of the rectangle and a pointer to a FloatSize
representing the height and width.
[in] | origin | A pointer to a FloatPoint representing the upper-left starting coordinate. |
[in] | size | A pointer to a FloatSize representing the height and width. |
Definition at line 472 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 FloatRect . |
FloatRect
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 (float y = rect.y(); y < rect.bottom(); ++y) {}
FloatPoint pp::FloatRect::CenterPoint | ( | ) | const |
CenterPoint() determines the center of this rectangle.
FloatPoint
representing the center of this rectangle. bool pp::FloatRect::Contains | ( | float | point_x, |
float | 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 float value representing a x value. |
[in] | point_y | An float 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 708 of file rect.h.
References Contains(), pp::FloatPoint::x(), and pp::FloatPoint::y().
bool pp::FloatRect::Contains | ( | const FloatRect & | rect | ) | const |
Contains() determines if this rectangle contains the specified rectangle.
[in] | rect | A pointer to a FloatRect . |
|
inline |
|
inline |
Getter function for returning the value of height.
FloatRect
. Definition at line 556 of file rect.h.
Referenced by bottom(), and operator==().
|
inline |
void pp::FloatRect::Inset | ( | float | left, |
float | top, | ||
float | right, | ||
float | bottom | ||
) |
Inset() shrinks the rectangle by the specified amount on each side.
[in] | left | An float value representing a left shrinking distance. |
[in] | top | An float value representing a top shrinking distance. |
[in] | right | An float value representing a right shrinking distance. |
[in] | bottom | An float value representing a bottom shrinking distance. |
Intersect() computes the intersection of this rectangle with the given rectangle.
[in] | rect | A pointer to a FloatRect . |
FloatRect
representing the intersection. bool pp::FloatRect::Intersects | ( | const FloatRect & | rect | ) | const |
Intersects() determines if this rectangle intersects the specified rectangle.
[in] | rect | A pointer to a FloatRect . |
|
inline |
void pp::FloatRect::Offset | ( | float | horizontal, |
float | vertical | ||
) |
|
inline |
Offset() moves the rectangle by a horizontal and vertical distance.
[in] | point | A pointer to a FloatPoint representing the horizontal and vertical move distances. |
Definition at line 680 of file rect.h.
References Offset(), pp::FloatPoint::x(), and pp::FloatPoint::y().
|
inline |
|
inline |
Getter function for returning the FloatPoint
.
FloatPoint
.
|
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 (float x = rect.x(); x < rect.right(); ++x) {}
|
inline |
Setter function for setting the value of height.
[in] | h | A new width height. |
Definition at line 563 of file rect.h.
References PP_DCHECK.
Referenced by FloatRect(), and SetRect().
|
inline |
Setter function for setting the value of the FloatPoint
.
[in] | origin | A FloatPoint representing the upper-left starting coordinate. |
Definition at line 582 of file rect.h.
Referenced by FloatRect().
|
inline |
Setter function for setting the FloatSize
.
[in] | s | A pointer to a FloatSize representing the height and width. |
Definition at line 597 of file rect.h.
References pp::FloatSize::height(), and pp::FloatSize::width().
Referenced by FloatRect().
|
inline |
Setter function for setting the value of width.
[in] | w | A new width value. |
Definition at line 545 of file rect.h.
References PP_DCHECK.
Referenced by FloatRect(), and SetRect().
|
inline |
Setter function for setting the value of x.
[in] | in_x | A new x value. |
Definition at line 517 of file rect.h.
Referenced by FloatRect(), and SetRect().
|
inline |
Setter function for setting the value of y.
[in] | in_y | A new y value. |
Definition at line 531 of file rect.h.
Referenced by FloatRect(), and SetRect().
|
inline |
Setter function for setting the value of the FloatRect
.
[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 630 of file rect.h.
References set_height(), set_width(), set_x(), and set_y().
|
inline |
bool pp::FloatRect::SharesEdgeWith | ( | const FloatRect & | 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 FloatRect . |
Subtract() computes the rectangle resulting from subtracting rect
from this Rect. If rect
does 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 FloatRect . |
FloatRect
representing the subtraction.
|
inline |
Getter function for returning the value of width.
FloatRect
. Definition at line 538 of file rect.h.
Referenced by operator==(), and right().
|
inline |
Getter function for returning the value of x.
FloatPoint
. Definition at line 510 of file rect.h.
Referenced by operator==(), and right().
|
inline |
Getter function for returning the value of y.
FloatPoint
. Definition at line 524 of file rect.h.
Referenced by bottom(), and operator==().