Pebble Foundation Classes
0.2.0
C++ for Pebble
|
Basic graphics types (point, rect, size, color, bitmaps, etc.) and utility functions. More...
Modules | |
Color Definitions | |
Classes | |
union | GColor8 |
struct | GPoint |
struct | GSize |
Represents a 2-dimensional size. More... | |
struct | GRect |
struct | GBitmapDataRowInfo |
struct | GEdgeInsets |
Macros | |
#define | GColorFromRGBA(red, green, blue, alpha) |
#define | GColorFromRGB(red, green, blue) GColorFromRGBA(red, green, blue, 255) |
#define | GColorFromHEX(v) GColorFromRGB(((v) >> 16) & 0xff, ((v) >> 8) & 0xff, ((v) & 0xff)) |
#define | COLOR_FALLBACK(color, bw) (color) |
#define | PBL_IF_RECT_ELSE(if_true, if_false) (if_true) |
#define | PBL_IF_ROUND_ELSE(if_true, if_false) (if_false) |
#define | PBL_IF_BW_ELSE(if_true, if_false) (if_false) |
#define | PBL_IF_COLOR_ELSE(if_true, if_false) (if_true) |
#define | GPoint(x, y) ((GPoint){(x), (y)}) |
Convenience macro to make a GPoint. | |
#define | GPointZero GPoint(0, 0) |
Convenience macro to make a GPoint at (0, 0). | |
#define | GSize(w, h) ((GSize){(w), (h)}) |
Convenience macro to make a GSize. | |
#define | GSizeZero GSize(0, 0) |
Convenience macro to make a GSize of (0, 0). | |
#define | GRect(x, y, w, h) ((GRect){{(x), (y)}, {(w), (h)}}) |
Convenience macro to make a GRect. | |
#define | GRectZero GRect(0, 0, 0, 0) |
Convenience macro to make a GRect of ((0, 0), (0, 0)). | |
#define | PLAY_COUNT_INFINITE UINT32_MAX |
Repeat Sequence or animation indefinitely. | |
#define | PLAY_DURATION_INFINITE UINT32_MAX |
Duration of Sequence or animation is infinite. | |
#define | GEdgeInsets4(t, r, b, l) ((GEdgeInsets){.top = t, .right = r, .bottom = b, .left = l}) |
helper for GEdgeInsets macro | |
#define | GEdgeInsets3(t, rl, b) ((GEdgeInsets){.top = t, .right = rl, .bottom = b, .left = rl}) |
helper for GEdgeInsets macro | |
#define | GEdgeInsets2(tb, rl) ((GEdgeInsets){.top = tb, .right = rl, .bottom = tb, .left = rl}) |
helper for GEdgeInsets macro | |
#define | GEdgeInsets1(trbl) ((GEdgeInsets){.top = trbl, .right = trbl, .bottom = trbl, .left = trbl}) |
helper for GEdgeInsets macro | |
#define | GEdgeInsetsN(_1, _2, _3, _4, NAME, ...) NAME |
helper for GEdgeInsets macro | |
#define | GEdgeInsets(...) GEdgeInsetsN(__VA_ARGS__, GEdgeInsets4, GEdgeInsets3, GEdgeInsets2, GEdgeInsets1)(__VA_ARGS__) |
Typedefs | |
typedef union GColor8 | GColor8 |
typedef GColor8 | GColor |
typedef struct GPoint | GPoint |
typedef struct GSize | GSize |
Represents a 2-dimensional size. | |
typedef struct GRect | GRect |
typedef enum GBitmapFormat | GBitmapFormat |
The format of a GBitmap can either be 1-bit or 8-bit. | |
typedef struct GBitmap | GBitmap |
typedef struct GBitmapSequence | GBitmapSequence |
typedef enum GAlign | GAlign |
typedef struct GContext | GContext |
Enumerations | |
enum | GBitmapFormat { GBitmapFormat1Bit = 0, GBitmapFormat8Bit, GBitmapFormat1BitPalette, GBitmapFormat2BitPalette, GBitmapFormat4BitPalette, GBitmapFormat8BitCircular } |
The format of a GBitmap can either be 1-bit or 8-bit. | |
enum | GAlign { GAlignCenter, GAlignTopLeft, GAlignTopRight, GAlignTop, GAlignLeft, GAlignBottom, GAlignRight, GAlignBottomRight, GAlignBottomLeft } |
enum | GCompOp { GCompOpAssign, GCompOpAssignInverted, GCompOpOr, GCompOpAnd, GCompOpClear, GCompOpSet } |
Functions | |
bool | gcolor_equal (GColor8 x, GColor8 y) |
True if both colors are identical or both are invisible (i.e. both have alpha values of .a=0). | |
GColor8 | gcolor_legible_over (GColor8 background_color) |
bool | gpoint_equal (const GPoint *const point_a, const GPoint *const point_b) |
bool | gsize_equal (const GSize *size_a, const GSize *size_b) |
bool | grect_equal (const GRect *const rect_a, const GRect *const rect_b) |
bool | grect_is_empty (const GRect *const rect) |
void | grect_standardize (GRect *rect) |
void | grect_clip (GRect *const rect_to_clip, const GRect *const rect_clipper) |
bool | grect_contains_point (const GRect *rect, const GPoint *point) |
GPoint | grect_center_point (const GRect *rect) |
GRect | grect_crop (GRect rect, const int32_t crop_size_px) |
uint16_t | gbitmap_get_bytes_per_row (const GBitmap *bitmap) |
GBitmapFormat | gbitmap_get_format (const GBitmap *bitmap) |
uint8_t * | gbitmap_get_data (const GBitmap *bitmap) |
void | gbitmap_set_data (GBitmap *bitmap, uint8_t *data, GBitmapFormat format, uint16_t row_size_bytes, bool free_on_destroy) |
GRect | gbitmap_get_bounds (const GBitmap *bitmap) |
void | gbitmap_set_bounds (GBitmap *bitmap, GRect bounds) |
GColor * | gbitmap_get_palette (const GBitmap *bitmap) |
void | gbitmap_set_palette (GBitmap *bitmap, GColor *palette, bool free_on_destroy) |
GBitmap * | gbitmap_create_with_resource (uint32_t resource_id) |
GBitmap * | gbitmap_create_with_data (const uint8_t *data) |
GBitmap * | gbitmap_create_as_sub_bitmap (const GBitmap *base_bitmap, GRect sub_rect) |
GBitmap * | gbitmap_create_from_png_data (const uint8_t *png_data, size_t png_data_size) |
GBitmap * | gbitmap_create_blank (GSize size, GBitmapFormat format) |
GBitmap * | gbitmap_create_blank_with_palette (GSize size, GBitmapFormat format, GColor *palette, bool free_on_destroy) |
GBitmap * | gbitmap_create_palettized_from_1bit (const GBitmap *src_bitmap) |
void | gbitmap_destroy (GBitmap *bitmap) |
GBitmapSequence * | gbitmap_sequence_create_with_resource (uint32_t resource_id) |
bool | gbitmap_sequence_update_bitmap_next_frame (GBitmapSequence *bitmap_sequence, GBitmap *bitmap, uint32_t *delay_ms) |
bool | gbitmap_sequence_update_bitmap_by_elapsed (GBitmapSequence *bitmap_sequence, GBitmap *bitmap, uint32_t elapsed_ms) |
void | gbitmap_sequence_destroy (GBitmapSequence *bitmap_sequence) |
bool | gbitmap_sequence_restart (GBitmapSequence *bitmap_sequence) |
int32_t | gbitmap_sequence_get_current_frame_idx (GBitmapSequence *bitmap_sequence) |
uint32_t | gbitmap_sequence_get_total_num_frames (GBitmapSequence *bitmap_sequence) |
uint32_t | gbitmap_sequence_get_play_count (GBitmapSequence *bitmap_sequence) |
void | gbitmap_sequence_set_play_count (GBitmapSequence *bitmap_sequence, uint32_t play_count) |
GSize | gbitmap_sequence_get_bitmap_size (GBitmapSequence *bitmap_sequence) |
GBitmapDataRowInfo | gbitmap_get_data_row_info (const GBitmap *bitmap, uint16_t y) |
void | grect_align (GRect *rect, const GRect *inside_rect, const GAlign alignment, const bool clip) |
GRect | grect_inset (GRect rect, GEdgeInsets insets) |
Basic graphics types (point, rect, size, color, bitmaps, etc.) and utility functions.
#define COLOR_FALLBACK | ( | color, | |
bw | |||
) | (color) |
Convenience macro allowing use of a fallback color for black and white platforms. On color platforms, the first expression will be chosen, the second otherwise.
#define GColorFromHEX | ( | v | ) | GColorFromRGB(((v) >> 16) & 0xff, ((v) >> 8) & 0xff, ((v) & 0xff)) |
Convert hex integer to GColor.
v | Integer hex value (e.g. 0x64ff46) |
#define GColorFromRGB | ( | red, | |
green, | |||
blue | |||
) | GColorFromRGBA(red, green, blue, 255) |
Convert RGB to GColor.
red | Red value from 0 - 255 |
green | Green value from 0 - 255 |
blue | Blue value from 0 - 255 |
#define GColorFromRGBA | ( | red, | |
green, | |||
blue, | |||
alpha | |||
) |
Convert RGBA to GColor.
red | Red value from 0 - 255 |
green | Green value from 0 - 255 |
blue | Blue value from 0 - 255 |
alpha | Alpha value from 0 - 255 |
#define GEdgeInsets | ( | ... | ) | GEdgeInsetsN(__VA_ARGS__, GEdgeInsets4, GEdgeInsets3, GEdgeInsets2, GEdgeInsets1)(__VA_ARGS__) |
Convenience macro to make a GEdgeInsets This macro follows the CSS shorthand notation where you can call it with
#define PBL_IF_BW_ELSE | ( | if_true, | |
if_false | |||
) | (if_false) |
Convenience macro to switch between two expression depending on the screen of the platform. On black& white platforms, the first expression will be chosen, the second otherwise.
#define PBL_IF_COLOR_ELSE | ( | if_true, | |
if_false | |||
) | (if_true) |
Convenience macro to switch between two expression depending on the screen of the platform. On color platforms, the first expression will be chosen, the second otherwise.
#define PBL_IF_RECT_ELSE | ( | if_true, | |
if_false | |||
) | (if_true) |
Convenience macro to switch between two expression depending on the screen of the platform. On platforms with rectangular screen, the first expression will be chosen, the second otherwise.
#define PBL_IF_ROUND_ELSE | ( | if_true, | |
if_false | |||
) | (if_false) |
Convenience macro to switch between two expression depending on the screen of the platform. On platforms with round screen, the first expression will be chosen, the second otherwise.
Values to specify how two things should be aligned relative to each other.
Represents a point in a 2-dimensional coordinate system.
Represents a rectangle and defining it using the origin of the upper-lefthand corner and its size.
enum GAlign |
Values to specify how two things should be aligned relative to each other.
enum GCompOp |
Values to specify how the source image should be composited onto the destination image.
Contrived example of how the different compositing modes affect drawing. Often, the "destination image" is the render buffer and thus contains the image of what has been drawn before or "underneath".
For color displays, only two compositing modes are supported, GCompOpAssign and GCompOpSet. The behavior of other compositing modes are undefined and may change in the future. Transparency can be achieved using GCompOpSet and requires pixel values with alpha value .a < 3.
GBitmap* gbitmap_create_as_sub_bitmap | ( | const GBitmap * | base_bitmap, |
GRect | sub_rect | ||
) |
Create a new GBitmap on the heap as a sub-bitmap of a 'base' GBitmap, using a GRect to indicate what portion of the base to use. The sub-bitmap will just reference the image data and palette of the base bitmap. No deep-copying occurs as a result of calling this function, thus the caller is responsible for making sure the base bitmap and palette will remain available when using the sub-bitmap. Note that you should not destroy the parent bitmap until the sub_bitmap has been destroyed. The resulting GBitmap must be destroyed using gbitmap_destroy().
[in] | base_bitmap | The bitmap that the sub-bitmap of which the image data will be used by the sub-bitmap |
sub_rect | The rectangle within the image data of the base bitmap. The bounds of the base bitmap will be used to clip sub_rect . |
NULL
if the GBitmap could not be created GBitmap* gbitmap_create_blank | ( | GSize | size, |
GBitmapFormat | format | ||
) |
Creates a new blank GBitmap on the heap initialized to zeroes. In the case that the format indicates a palettized bitmap, a palette of appropriate size will also be allocated on the heap. The resulting GBitmap must be destroyed using gbitmap_destroy().
size | The Pebble image dimensions as a GSize. |
format | The GBitmapFormat the created image should be in. |
NULL
if the GBitmap could not be created GBitmap* gbitmap_create_blank_with_palette | ( | GSize | size, |
GBitmapFormat | format, | ||
GColor * | palette, | ||
bool | free_on_destroy | ||
) |
Creates a new blank GBitmap on the heap, initialized to zeroes, and assigns it the given palette. No deep-copying of the palette occurs, so the caller is responsible for making sure the palette remains available when using the resulting bitmap. Management of that memory can be handed off to the system with the free_on_destroy argument.
size | The Pebble image dimensions as a GSize. |
format | the GBitmapFormat the created image and palette should be in. |
palette | a pointer to a palette that is to be used for this GBitmap. The palette should be large enough to hold enough colors for the specified format. For example, GBitmapFormat2BitPalette should have 4 colors, since 2^2 = 4. |
free_on_destroy | Set whether the palette data should be freed along with the bitmap data when the GBitmap is destroyed. |
NULL
if the GBitmap could not be created. GBitmap* gbitmap_create_from_png_data | ( | const uint8_t * | png_data, |
size_t | png_data_size | ||
) |
Create a GBitmap based on raw PNG data. The resulting GBitmap must be destroyed using gbitmap_destroy(). The developer is responsible for freeing png_data following this call.
png_data | PNG image data. |
png_data_size | PNG image size in bytes. |
NULL
if the GBitmap could not be created GBitmap* gbitmap_create_palettized_from_1bit | ( | const GBitmap * | src_bitmap | ) |
Given a 1-bit GBitmap, create a new bitmap of format GBitmapFormat1BitPalette. The new data buffer is allocated on the heap, and a 2-color palette is allocated as well.
src_bitmap | A GBitmap of format GBitmapFormat1Bit which is to be copied into a newly created GBitmap of format GBitmapFormat1BitPalettized. |
GBitmap* gbitmap_create_with_data | ( | const uint8_t * | data | ) |
Creates a new GBitmap on the heap initialized with the provided Pebble image data.
The resulting GBitmap must be destroyed using gbitmap_destroy() but the image data will not be freed automatically. The developer is responsible for keeping the image data in memory as long as the bitmap is used and releasing it after the bitmap is destroyed.
data | The Pebble image data. Must not be NULL. The function assumes the data to be correct; there are no sanity checks performed on the data. The data will not be copied and the pointer must remain valid for the lifetime of this GBitmap. |
NULL
if the GBitmap could not be created GBitmap* gbitmap_create_with_resource | ( | uint32_t | resource_id | ) |
Creates a new GBitmap on the heap using a Pebble image file stored as a resource. The resulting GBitmap must be destroyed using gbitmap_destroy().
resource_id | The ID of the bitmap resource to load |
NULL
if the GBitmap could not be created void gbitmap_destroy | ( | GBitmap * | bitmap | ) |
Destroy a GBitmap. This must be called for every bitmap that's been created with gbitmap_create_*
This function will also free the memory of the bitmap data (bitmap->addr) if the bitmap was created with gbitmap_create_blank() or gbitmap_create_with_resource().
If the GBitmap was created with gbitmap_create_with_data(), you must release the memory after calling gbitmap_destroy().
GRect gbitmap_get_bounds | ( | const GBitmap * | bitmap | ) |
Gets the bounds of the content for the GBitmap. This is set when loading the image or if changed by gbitmap_set_bounds.
bitmap | A pointer to the GBitmap to get the bounding box from. |
uint16_t gbitmap_get_bytes_per_row | ( | const GBitmap * | bitmap | ) |
Get the number of bytes per row in the bitmap data for the given GBitmap. On rectangular displays, this can be used as a safe way of iterating over the rows in the bitmap, since bytes per row should be set according to format. On circular displays with pixel format of GBitmapFormat8BitCircular this will return 0, and should not be used for iteration over frame buffer pixels. Instead, use GBitmapDataRowInfo, which provides safe minimum and maximum x values for a given row's y value.
bitmap | A pointer to the GBitmap to get the bytes per row |
uint8_t* gbitmap_get_data | ( | const GBitmap * | bitmap | ) |
Get a pointer to the raw image data section of the given GBitmap as specified by the format of the bitmap.
bitmap | A pointer to the GBitmap to get the data |
GBitmapDataRowInfo gbitmap_get_data_row_info | ( | const GBitmap * | bitmap, |
uint16_t | y | ||
) |
Provides information about a pixel data row
bitmap | A pointer to the GBitmap to get row info |
y | Absolute row number in the pixel data, independent from the bitmap's bounds |
GBitmapFormat gbitmap_get_format | ( | const GBitmap * | bitmap | ) |
Get the GBitmapFormat for the GBitmap.
bitmap | A pointer to the GBitmap to get the format |
GColor* gbitmap_get_palette | ( | const GBitmap * | bitmap | ) |
Get the palette for the given GBitmap.
bitmap | A pointer to the GBitmap to get the palette from. |
GBitmapSequence* gbitmap_sequence_create_with_resource | ( | uint32_t | resource_id | ) |
Creates a GBitmapSequence from the specified resource (APNG/PNG files)
resource_id | Resource to load and create GBitmapSequence from. |
void gbitmap_sequence_destroy | ( | GBitmapSequence * | bitmap_sequence | ) |
Deletes the GBitmapSequence structure and frees any allocated memory/decoder_data
bitmap_sequence | Pointer to the bitmap sequence to free (delete) |
GSize gbitmap_sequence_get_bitmap_size | ( | GBitmapSequence * | bitmap_sequence | ) |
This function gets the minimum required size (dimensions) necessary to render the bitmap sequence to a GBitmap using the /ref gbitmap_sequence_update_bitmap_next_frame
bitmap_sequence | Pointer to loaded bitmap sequence |
int32_t gbitmap_sequence_get_current_frame_idx | ( | GBitmapSequence * | bitmap_sequence | ) |
This function gets the current frame number for the bitmap sequence
bitmap_sequence | Pointer to loaded bitmap sequence |
uint32_t gbitmap_sequence_get_play_count | ( | GBitmapSequence * | bitmap_sequence | ) |
This function gets the play count (number of times to repeat) the bitmap sequence
bitmap_sequence | Pointer to loaded bitmap sequence |
uint32_t gbitmap_sequence_get_total_num_frames | ( | GBitmapSequence * | bitmap_sequence | ) |
This function sets the total number of frames for the bitmap sequence
bitmap_sequence | Pointer to loaded bitmap sequence |
bool gbitmap_sequence_restart | ( | GBitmapSequence * | bitmap_sequence | ) |
Restarts the GBitmapSequence to the first frame gbitmap_sequence_update_bitmap_next_frame
bitmap_sequence | Pointer to loaded bitmap sequence |
void gbitmap_sequence_set_play_count | ( | GBitmapSequence * | bitmap_sequence, |
uint32_t | play_count | ||
) |
This function sets the play count (number of times to repeat) the bitmap sequence
bitmap_sequence | Pointer to loaded bitmap sequence |
play_count | Number of times to repeat the bitmap sequence with 0 disabling update_by_elapsed and update_next_frame, and PLAY_COUNT_INFINITE for infinite looping of the animation |
bool gbitmap_sequence_update_bitmap_by_elapsed | ( | GBitmapSequence * | bitmap_sequence, |
GBitmap * | bitmap, | ||
uint32_t | elapsed_ms | ||
) |
Updates the contents of the bitmap sequence to the frame at elapsed in the sequence. For looping animations this accounts for the loop, for example an animation of 1 second that is configured to loop 2 times updated to 1500 ms elapsed time will display the sequence frame at 500 ms. Elapsed time is the time from the start of the animation, and will be ignored if it is for a time earlier than the last rendered frame.
bitmap_sequence | Pointer to loaded bitmap sequence |
bitmap | Pointer to the initialized GBitmap in which to render the bitmap sequence |
elapsed_ms | Elapsed time in milliseconds in the sequence relative to start |
bool gbitmap_sequence_update_bitmap_next_frame | ( | GBitmapSequence * | bitmap_sequence, |
GBitmap * | bitmap, | ||
uint32_t * | delay_ms | ||
) |
Updates the contents of the bitmap sequence to the next frame and optionally returns the delay in milliseconds until the next frame.
bitmap_sequence | Pointer to loaded bitmap sequence | |
bitmap | Pointer to the initialized GBitmap in which to render the bitmap sequence | |
[out] | delay_ms | If not NULL, returns the delay in milliseconds until the next frame. |
void gbitmap_set_bounds | ( | GBitmap * | bitmap, |
GRect | bounds | ||
) |
Set the bounds of the given GBitmap.
bitmap | A pointer to the GBitmap to set the bounding box. |
bounds | The bounding box to set. |
void gbitmap_set_data | ( | GBitmap * | bitmap, |
uint8_t * | data, | ||
GBitmapFormat | format, | ||
uint16_t | row_size_bytes, | ||
bool | free_on_destroy | ||
) |
Set the bitmap data for the given GBitmap.
bitmap | A pointer to the GBitmap to set data to |
data | A pointer to the bitmap data |
format | the format of the bitmap data. If this is a palettized format, make sure that there is an accompanying call to gbitmap_set_palette. |
row_size_bytes | How many bytes a single row takes. For example, bitmap data of format GBitmapFormat1Bit must have a row size as a multiple of 4 bytes. |
free_on_destroy | Set whether the data should be freed when the GBitmap is destroyed. |
void gbitmap_set_palette | ( | GBitmap * | bitmap, |
GColor * | palette, | ||
bool | free_on_destroy | ||
) |
Set the palette for the given GBitmap.
bitmap | A pointer to the GBitmap to set the palette to |
palette | The palette to be used. Make sure that the palette is large enough for the bitmap's format. |
free_on_destroy | Set whether the palette data should be freed when the GBitmap is destroyed or when another palette is set. |
This method assists in improving the legibility of text on various background colors. It takes the background color for the region in question and computes a color for maximum legibility.
background_color | Background color for the region in question |
Tests whether 2 points are equal.
point_a | Pointer to the first point |
point_b | Pointer to the second point |
true
if both points are equal, false
if not. void grect_align | ( | GRect * | rect, |
const GRect * | inside_rect, | ||
const GAlign | alignment, | ||
const bool | clip | ||
) |
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.
[in] | rect | The rectangle to align (in place) |
[out] | rect | The aligned and optionally clipped rectangle |
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. |
Convenience function to compute the center-point of a given rectangle. This is equal to (rect->x + rect->width / 2, rect->y + rect->height / 2)
.
rect | The rectangle for which to calculate the center point. |
rect
Trim one rectangle using the edges of a second rectangle.
[in] | rect_to_clip | The rectangle that needs to be clipped (in place). |
[out] | rect_to_clip | The clipped rectangle. |
rect_clipper | The rectangle of which the edges will serve as "scissors" in order to trim rect_to_clip . |
Tests whether a rectangle contains a point.
rect | The rectangle |
point | The point |
true
if the rectangle contains the point, or false
if it does not. 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.
rect | The rectangle that will be inset |
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. |
Tests whether 2 rectangles are equal.
rect_a | Pointer to the first rectangle |
rect_b | Pointer to the second rectangle |
true
if both rectangles are equal, false
if not. GRect grect_inset | ( | GRect | rect, |
GEdgeInsets | insets | ||
) |
Returns a rectangle that is shrinked or expanded by the given edge insets.
rect | The rectangle that will be inset |
insets | The insets that will be applied |
bool grect_is_empty | ( | const GRect *const | rect | ) |
Tests whether the size of the rectangle is (0, 0).
rect | Pointer to the rectangle |
true
if the rectangle its size is (0, 0), or false
if not. true
! void grect_standardize | ( | GRect * | rect | ) |
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).
[in] | rect | The rectangle to convert. |
[out] | rect | The standardized rectangle. |