Pebble Foundation Classes
0.2.0
C++ for Pebble
|
#include <pebble_graphics_types.hpp>
Public Member Functions | |
GRect () | |
Constructs an empty GRect. | |
GRect (const ::GRect &rect) | |
Converts from Pebble GRect. | |
GRect (int16_t x, int16_t y, int16_t w, int16_t h) | |
GRect (::GPoint origin, ::GSize size) | |
GRect (GPoint origin, GSize size) | |
operator::GRect & () | |
Convert to a Pebble GRect. | |
operator const ::GRect & () const | |
Convert to a Pebble GRect. | |
operator::GRect * () | |
Convert to a Pebble GRect pointer. | |
operator const ::GRect * () const | |
Convert to a Pebble GRect pointer. | |
bool | operator== (const ::GRect &rect) const |
bool | operator!= (const ::GRect &rect) const |
void | Align (const ::GRect &inside_rect, const GAlign alignment, const bool clip) |
GPoint | CenterPoint () const |
GRect | Inset (GEdgeInsets insets) const |
bool | IsEmpty () |
void | Standardize () |
void | Clip (const GRect &rect_clipper) |
bool | ContainsPoint (const GPoint &point) |
GRect | Crop (int32_t crop_size_px) |
GPoint | FromPolar (GOvalScaleMode scale_mode, int32_t angle) |
GRect | CenterFromPolar (GOvalScaleMode scale_mode, int32_t angle, GSize size) |
Public Attributes | |
GPoint | origin |
The coordinate of the upper-lefthand corner point of the rectangle. | |
GSize | size |
The size of the rectangle. | |
Represents a rectangle and defining it using the origin of the upper-lefthand corner and its size.
|
inline |
Constructs from a position and size
x | The X coordinate |
y | The Y coordinate |
w | The width |
h | The height |
Construct a GRect from a Pebble point and size
origin | Origin |
size | Size |
Construct a GRect from a point and size
origin | Origin |
size | Size |
|
inline |
Aligns one rectangle within another rectangle, using an alignment parameter. The relative coordinate systems of both rectangles are assumed to be the same. When clip is true, rect
is also clipped by the constraint.
inside_rect | The rectangle in which to align rect |
alignment | Determines the alignment of rect within inside_rect by specifying what edges of should overlap. |
clip | Determines whether rect should be trimmed using the edges of inside_rect in case rect extends outside of the area that inside_rect covers after the alignment. |
|
inline |
Calculates a rectangle centered on the perimeter of a circle at a given angle. Use this to construct rectangles that follow the perimeter of a circle as an input for graphics_fill_radial_internal or graphics_draw_arc_internal, e.g. to draw circles every 30 degrees on a watchface.
scale_mode | Determines how rect will be used to derive the circle's center point and radius. |
angle | The angle at which the point on the circle's perimeter should be calculated. Use DEG_TO_TRIGANGLE to easily convert degrees to the appropriate value. |
size | Width and height of the desired rectangle. |
|
inline |
Convenience method to compute the center-point of a given rectangle. This is equal to (rect->x + rect->width / 2, rect->y + rect->height / 2)
.
rect
|
inline |
Trim one rectangle using the edges of a second rectangle.
rect_clipper | The rectangle of which the edges will serve as "scissors" in order to trim rect_to_clip . |
|
inline |
Tests whether a rectangle contains a point.
point | The point |
true
if the rectangle contains the point, or false
if it does not.
|
inline |
Reduce the width and height of a rectangle by insetting each of the edges with a fixed inset. The returned rectangle will be centered relative to the input rectangle.
crop_size_px | The inset by which each of the rectangle will be inset. A positive inset value results in a smaller rectangle, while negative inset value results in a larger rectangle. |
|
inline |
Calculates a GPoint located at the angle provided on the perimeter of a circle defined by the provided GRect.
scale_mode | Determines how rect will be used to derive the center point and radius. |
angle | The angle at which the point on the circle's perimeter should be calculated. Use DEG_TO_TRIGANGLE to easily convert degrees to the appropriate value. |
|
inline |
Returns a rectangle that is shrinked or expanded by the given edge insets.
insets | The insets that will be applied |
|
inline |
Tests whether the size of the rectangle is (0, 0).
true
if the rectangle its size is (0, 0), or false
if not. true
!
|
inline |
Tests whether 2 rectangles are not equal.
rect | The second rectangle |
true
if both rectangles are not equal, false
if equal.
|
inline |
Tests whether 2 rectangles are equal.
rect | The second rectangle |
true
if both rectangles are equal, false
if not.
|
inline |
Converts a rectangle's values so that the components of its size (width and/or height) are both positive. In the width and/or height are negative, the origin will offset, so that the final rectangle overlaps with the original. For example, a GRect with size (-10, -5) and origin (20, 20), will be standardized to size (10, 5) and origin (10, 15).