MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_utils.h File Reference

General internal utilities for the library. More...

Include dependency graph for legato_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LE_TEST_FLAG(val, flag)   ((val & flag) > 0)
 

Typedefs

typedef struct leWidget leWidget
 Used to define a widget. More...
 
typedef struct leList leList
 

Functions

leWidgetleUtils_PickFromWidget (const leWidget *wgt, int32_t x, int32_t y)
 Finds the top-most visible widget in a layer at the given coordinates. More...
 
void leUtils_PointToScreenSpace (const leWidget *widget, lePoint *pnt)
 Converts a point from widget space into screen space. More...
 
void leUtils_PointScreenToLocalSpace (const leWidget *widget, lePoint *pnt)
 Convert point from layer space into the local space of a widget. More...
 
void leUtils_ClipRectToParent (const leWidget *widget, leRect *rect)
 Clips a rectangle to the parent of a widge. More...
 
void leUtils_RectToParentSpace (const leWidget *widget, leRect *rect)
 Convert rectangle from widget local space to widget parent space. More...
 
void leUtils_RectFromParentSpace (const leWidget *widget, leRect *rect)
 Convert rectangle from widget parent space to widget local space. More...
 
void leUtils_RectToScreenSpace (const leWidget *widget, leRect *rect)
 Convert rectangle from widget local space to screen space. More...
 
leBool leUtils_ChildIntersectsParent (const leWidget *parent, const leWidget *child)
 Determines if parent and child intersect. More...
 
void leUtils_ClipRectToAncestors (const leWidget *wgt, struct leRect *rct)
 Clips a widget's rectangle to the widget tree hierarchy. More...
 
leWidgetleUtils_GetNextHighestWidget (const leWidget *wgt)
 Get next highest Z order widget in the tree from 'wgt'. More...
 
void leUtils_ArrangeRectangle (leRect *sub, leRect obj, leRect bounds, leHAlignment hAlignment, leVAlignment vAlignment, leRelativePosition position, uint8_t leftMargin, uint8_t topMargin, uint8_t rightMargin, uint8_t bottomMargin, uint16_t rectMargin)
 Calculates the position of a rectangle within the given bound. More...
 
void leUtils_ArrangeRectangleRelative (leRect *sub, leRect obj, leRect bounds, leHAlignment hAlignment, leVAlignment vAlignment, leRelativePosition position, uint8_t leftMargin, uint8_t topMargin, uint8_t rightMargin, uint8_t bottomMargin, uint16_t rectMargin)
 Calculates the position of a rectangle within the given bounds. More...
 
void leUtils_PointLogicalToScratch (int16_t *x, int16_t *y)
 
void leUtils_RectLogicalToScratch (leRect *rect)
 
const leBlendLookupTableleUtils_GetSchemeLookupTable (const leScheme *schm, leColor foreground, leColor background)
 

Detailed Description

General internal utilities for the library.

Typedef Documentation

◆ leWidget

typedef struct leWidget leWidget

Used to define a widget.

Function Documentation

◆ leUtils_ArrangeRectangle()

void leUtils_ArrangeRectangle ( leRect sub,
leRect  obj,
leRect  bounds,
leHAlignment  hAlignment,
leVAlignment  vAlignment,
leRelativePosition  position,
uint8_t  leftMargin,
uint8_t  topMargin,
uint8_t  rightMargin,
uint8_t  bottomMargin,
uint16_t  rectMargin 
)

Calculates the position of a rectangle within the given bound.

Calculates the position of a rectangle within the given bounds and in accordance with the given parameters. A use case for this is when an image and a text rectangle must be arranged in a button box. This version of the algorithm will calculate the location of the image rectangle.

Parameters
widgetposition.
rectposition.
Returns
void.

◆ leUtils_ArrangeRectangleRelative()

void leUtils_ArrangeRectangleRelative ( leRect sub,
leRect  obj,
leRect  bounds,
leHAlignment  hAlignment,
leVAlignment  vAlignment,
leRelativePosition  position,
uint8_t  leftMargin,
uint8_t  topMargin,
uint8_t  rightMargin,
uint8_t  bottomMargin,
uint16_t  rectMargin 
)

Calculates the position of a rectangle within the given bounds.

Calculates the position of a rectangle within the given bounds and in accordance with the given parameters. A use case for this is when an image and a text rectangle must be arranged in a button box. This version of the algorithm will calculate the location of the image rectangle.

Remarks
The x and y position of sub will be manipulated by this function. The dimensions of the rectangle should be set before calling and should remain unchanged after execution.
Parameters
widgetposition.
rectposition.
Returns
void.
Here is the call graph for this function:

◆ leUtils_ChildIntersectsParent()

leBool leUtils_ChildIntersectsParent ( const leWidget parent,
const leWidget child 
)

Determines if parent and child intersect.

Determines if parent and child intersects.

const leWidget* parent;
const leWidget* child;
Parameters
widgetthe parent widget.
childthe child widget.
Returns
void.
Here is the call graph for this function:

◆ leUtils_ClipRectToAncestors()

void leUtils_ClipRectToAncestors ( const leWidget wgt,
struct leRect rct 
)

Clips a widget's rectangle to the widget tree hierarchy.

Clips a widget's rectangle to the widget tree hierarchy

const leWidget* parent;
struct leRect* result
Parameters
widgetthe parent widget.
resultthe clipped rectangle
Returns
void.

◆ leUtils_ClipRectToParent()

void leUtils_ClipRectToParent ( const leWidget widget,
leRect rect 
)

Clips a rectangle to the parent of a widge.

Clips a rectangle rect to parent of widget.

leRect* rect;
Parameters
widgetposition.
rectposition.
Returns
void.
Here is the call graph for this function:

◆ leUtils_GetNextHighestWidget()

leWidget* leUtils_GetNextHighestWidget ( const leWidget wgt)

Get next highest Z order widget in the tree from 'wgt'.

Gets the next the highest Z order widget in the tree widget.

Parameters
widgetposition.
rectposition.
Returns
the next highest widget or NULL if 'wgt' is already the highest.
Here is the caller graph for this function:

◆ leUtils_PickFromWidget()

leWidget* leUtils_PickFromWidget ( const leWidget wgt,
int32_t  x,
int32_t  y 
)

Finds the top-most visible widget in a layer at the given coordinates.

Finds the top-most visible widget in wgt at the given coordinates x and y.

leWidget* wdt = leUtils_PickFromWidget(wgt, x, y);
Parameters
wgtthe widget to pick from
xposition.
yposition.
Returns
the result widget.
Here is the call graph for this function:

◆ leUtils_PointScreenToLocalSpace()

void leUtils_PointScreenToLocalSpace ( const leWidget widget,
lePoint pnt 
)

Convert point from layer space into the local space of a widget.

Converts pnt corresponding to layer space to widget space.

const leWidget* widget;
lePoint* pnt;
Parameters
widgetposition.
pntposition.
Returns
void.

◆ leUtils_PointToScreenSpace()

void leUtils_PointToScreenSpace ( const leWidget widget,
lePoint pnt 
)

Converts a point from widget space into screen space.

Converts point corresponding to widget space to screen space.

const leWidget* widget;
lePoint* pnt;
Parameters
widgetthe subject widget.
pntthe point to convert.
Returns
void.

◆ leUtils_RectFromParentSpace()

void leUtils_RectFromParentSpace ( const leWidget widget,
leRect rect 
)

Convert rectangle from widget parent space to widget local space.

Converts rect to widget space.

const leWidget* widget;
leRect* rect;
Parameters
widgetposition.
rectposition.
Returns
void.

◆ leUtils_RectToParentSpace()

void leUtils_RectToParentSpace ( const leWidget widget,
leRect rect 
)

Convert rectangle from widget local space to widget parent space.

Converts rect from widget space to parent space.

Remarks
Widget must be a child of a layer for this to function.
const leWidget* widget;
leRect* rect;
Parameters
widgetposition.
rectposition.
Returns
void.

◆ leUtils_RectToScreenSpace()

void leUtils_RectToScreenSpace ( const leWidget widget,
leRect rect 
)

Convert rectangle from widget local space to screen space.

Converts rect from widget space to screen space.

const leWidget* widget;
leRect* rect;
Parameters
widgetposition.
rectposition.
Returns
void.