Functions
Rectangle_api

Functions

void Graphics_drawRectangle (const Graphics_Context *context, const Graphics_Rectangle *rect)
 
void Graphics_fillRectangle (const Graphics_Context *context, const Graphics_Rectangle *rect)
 
int32_t Graphics_isRectangleOverlap (Graphics_Rectangle *rect1, Graphics_Rectangle *rect2)
 
int32_t Graphics_getRectangleIntersection (Graphics_Rectangle *rect1, Graphics_Rectangle *rect2, Graphics_Rectangle *intersect)
 
bool Graphics_isPointWithinRectangle (const Graphics_Rectangle *rect, uint16_t x, uint16_t y)
 

Detailed Description

Function Documentation

void Graphics_drawRectangle ( const Graphics_Context context,
const Graphics_Rectangle rect 
)

Draws a rectangle.

Parameters
contextis a pointer to the drawing context to use.
rectis a pointer to the structure containing the extents of the rectangle.

This function draws a rectangle. The rectangle will extend from xMin to xMax and yMin to yMax, inclusive.

Returns
None.

References Graphics_drawLineH(), Graphics_drawLineV(), Graphics_Rectangle::xMax, Graphics_Rectangle::xMin, Graphics_Rectangle::yMax, and Graphics_Rectangle::yMin.

Referenced by Graphics_drawCheckBox(), and Graphics_drawReleasedCheckBox().

void Graphics_fillRectangle ( const Graphics_Context context,
const Graphics_Rectangle rect 
)

Draws a filled rectangle.

Parameters
contextis a pointer to the drawing context to use.
rectis a pointer to the structure containing the extents of the rectangle.

This function draws a filled rectangle. The rectangle will extend from xMin to xMax and yMin to yMax, inclusive. The clipping of the rectangle to the clipping rectangle is performed within this routine; the display driver's rectangle fill routine is used to perform the actual rectangle fill.

Returns
None.

References Graphics_Context::clipRegion, Graphics_Context::display, Graphics_Context::foreground, Graphics_fillRectangleOnDisplay(), Graphics_Rectangle::xMax, Graphics_Rectangle::xMin, Graphics_Rectangle::yMax, and Graphics_Rectangle::yMin.

Referenced by Graphics_drawCheckBox(), Graphics_drawImageButton(), Graphics_drawReleasedCheckBox(), Graphics_drawReleasedImageButton(), and Graphics_drawSelectedImageButton().

int32_t Graphics_isRectangleOverlap ( Graphics_Rectangle rect1,
Graphics_Rectangle rect2 
)

Determines if two rectangles overlap.

Parameters
rect1is a pointer to the first rectangle.
rect2is a pointer to the second rectangle.

This function determines whether two rectangles overlap. It assumes that rectangles rect1 and rect2 are valid with xMin < xMax and yMin < yMax.

Returns
Returns 1 if there is an overlap or 0 if not.

References Graphics_Rectangle::xMax, Graphics_Rectangle::xMin, Graphics_Rectangle::yMax, and Graphics_Rectangle::yMin.

Referenced by Graphics_getRectangleIntersection().

int32_t Graphics_getRectangleIntersection ( Graphics_Rectangle rect1,
Graphics_Rectangle rect2,
Graphics_Rectangle intersect 
)

Determines the intersection of two rectangles.

Parameters
rect1is a pointer to the first rectangle.
rect2is a pointer to the second rectangle.
intersectis a pointer to a rectangle which will be written with the intersection of rect1 and rect2.

This function determines if two rectangles overlap and, if they do, calculates the rectangle representing their intersection. If the rectangles do not overlap, 0 is returned and intersect is not written.

Returns
Returns 1 if there is an overlap or 0 if not.

References Graphics_isRectangleOverlap(), max, min, Graphics_Rectangle::xMax, Graphics_Rectangle::xMin, Graphics_Rectangle::yMax, and Graphics_Rectangle::yMin.

bool Graphics_isPointWithinRectangle ( const Graphics_Rectangle rect,
uint16_t  x,
uint16_t  y 
)

Determines if a point lies within a given rectangle.

Parameters
rectis a pointer to the rectangle which the point is to be checked against.
xis the X coordinate of the point to be checked.
yis the Y coordinate of the point to be checked.

This function determines whether point (x, y) lies within the rectangle described by rect.

Returns
Returns 1 if the point is within the rectangle or 0 otherwise.

Copyright 2016, Texas Instruments Incorporated