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

An array implementation for storing rectangles for the Legato user interface library. More...

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

Go to the source code of this file.

Data Structures

struct  leRectArray
 This struct represents a rectange array. More...
 

Typedefs

typedef struct leRectArray leRectArray
 This struct represents a rectange array.
 

Functions

leResult leRectArray_Create (leRectArray *arr)
 Creates a new rectangle. More...
 
leResult leRectArray_Resize (leRectArray *arr, uint32_t sz)
 Resizes the capacity of the array. More...
 
leResult leRectArray_PushFront (leRectArray *arr, const leRect *rect)
 Pushes a new rectangle onto the front of the array. More...
 
leResult leRectArray_PopFront (leRectArray *arr)
 Removes the first value from the array. More...
 
leResult leRectArray_PushBack (leRectArray *arr, const leRect *rect)
 Push value on back. More...
 
leResult leRectArray_PopBack (leRectArray *arr)
 Removes the last rectangle from the array. More...
 
leResult leRectArray_InsertAt (leRectArray *arr, uint32_t idx, const leRect *rect)
 Inserts a rectangle into an array at a given index. More...
 
leResult leRectArray_RemoveAt (leRectArray *arr, uint32_t idx)
 Removes a rectangle from the array at an index. More...
 
leResult leRectArray_Copy (leRectArray *src, leRectArray *dest)
 Copy array. More...
 
leResult leRectArray_Clear (leRectArray *arr)
 Removes all values from a given array. More...
 
leResult leRectArray_Destroy (leRectArray *arr)
 Destroy array. More...
 
leResult leRectArray_RemoveDuplicates (leRectArray *arr)
 Removes any duplicate rectangles from an array. More...
 
leResult leRectArray_SortBySize (leRectArray *arr)
 Sorts a given array. More...
 
leResult leRectArray_SortByX (leRectArray *arr)
 Sort array by X coordinate. More...
 
leResult leRectArray_SortByY (leRectArray *arr)
 Sort array by Y coordinate. More...
 
leResult leRectArray_MergeSimilar (leRectArray *arr)
 Merge rectangles. More...
 
leResult leRectArray_RemoveOverlapping (leRectArray *arr)
 Remove overlappping rectangles. More...
 
leResult leRectArray_CropToArea (leRectArray *arr, uint32_t width, uint32_t height)
 Crops rectange by width and height. More...
 
leResult leRectArray_CropToSizeY (leRectArray *arr, uint32_t size)
 Slices an array of rectangles to a given pixel count. More...
 
leResult leRectArray_CropToSizeX (leRectArray *arr, uint32_t size)
 Slices an array of rectangles to a given pixel count. More...
 

Detailed Description

An array implementation for storing rectangles for the Legato user interface library.

This is an array implementation that is used internally by the Legato user interface library.

Function Documentation

◆ leRectArray_Clear()

leResult leRectArray_Clear ( leRectArray arr)

Removes all values from a given array.

Removes all values from arr. Array capacity remains the same.

Parameters
arris the array to modify.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_Copy()

leResult leRectArray_Copy ( leRectArray src,
leRectArray dest 
)

Copy array.

Copys the contents of src to the array pointed to by dest.

leResult res = leRectArray_Copy(arr, dest)
Parameters
srcis the source array.
destis the destination array.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_Create()

leResult leRectArray_Create ( leRectArray arr)

Creates a new rectangle.

Creates a new rectangle arr.

Parameters
arris array to initialize.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_CropToArea()

leResult leRectArray_CropToArea ( leRectArray arr,
uint32_t  width,
uint32_t  height 
)

Crops rectange by width and height.

Crops arr to given width and height. Any remainder will be moved into a new rectangle and will be cropped again if needed.

uint32_t width;
uint32_t height;
leResult res = leRectArray_CropToArea(arr, width, height);
Parameters
arrthe array to modify.
widththe crop width.
heightarr the crop height.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the call graph for this function:

◆ leRectArray_CropToSizeX()

leResult leRectArray_CropToSizeX ( leRectArray arr,
uint32_t  size 
)

Slices an array of rectangles to a given pixel count.

Crops arr to given width and size. This method attempts to keep the rectangle slices as tall as possible.

uint32_t size;
Parameters
arrthe array to modify.
sizethe number of pixels to crop to.
Returns
LE_SUCCESS , otherwise LE_FAILURE.

◆ leRectArray_CropToSizeY()

leResult leRectArray_CropToSizeY ( leRectArray arr,
uint32_t  size 
)

Slices an array of rectangles to a given pixel count.

Crops arr to given width and size. This method attempts to keep the rectangle slices as wide as possible.

uint32_t size;
Parameters
arrthe array to modify.
sizethe number of pixels to crop to.
Returns
LE_SUCCESS , otherwise LE_FAILURE.

◆ leRectArray_Destroy()

leResult leRectArray_Destroy ( leRectArray arr)

Destroy array.

Removes all values from arr. Array capacity is set to 0. leRectArray* arr; leResult res = leRectArray_Destroy(arr)

Parameters
arrthe array to modify.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_InsertAt()

leResult leRectArray_InsertAt ( leRectArray arr,
uint32_t  idx,
const leRect rect 
)

Inserts a rectangle into an array at a given index.

Inserts rect into the arr at the specified idx. All existing values from index are shifted right one place.

uint32_t idx;
leRect* val;
leResult res = leRectArray_InsertAt(arr idx, val)
Parameters
arris the array to modify.
idxis the location at which to insert value.
valis value to insert.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_MergeSimilar()

leResult leRectArray_MergeSimilar ( leRectArray arr)

Merge rectangles.

Merges similar rectangles in arr.

Parameters
arrthe array to modify.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the call graph for this function:

◆ leRectArray_PopBack()

leResult leRectArray_PopBack ( leRectArray arr)

Removes the last rectangle from the array.

Removes the last value from the back of arr.

Parameters
arris the array to modify.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_PopFront()

leResult leRectArray_PopFront ( leRectArray arr)

Removes the first value from the array.

Removes the first value from the front of arr. This function shuffles all other values forward one index.

Parameters
arrThe pointer to the array to modify.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_PushBack()

leResult leRectArray_PushBack ( leRectArray arr,
const leRect rect 
)

Push value on back.

Pushes val onto the back of arr.

leArray* arr;
leRect* val;
Parameters
arris the array to modify.
valis the value to push.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the caller graph for this function:

◆ leRectArray_PushFront()

leResult leRectArray_PushFront ( leRectArray arr,
const leRect rect 
)

Pushes a new rectangle onto the front of the array.

Pushes val onto the front of arr. This function shuffles all other values backward one index.

Parameters
arris the array to modify.
valis the value to push.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_RemoveAt()

leResult leRectArray_RemoveAt ( leRectArray arr,
uint32_t  idx 
)

Removes a rectangle from the array at an index.

Removes the rectangle at idx from arr.

uint32_t idx;
Parameters
arris the array to modify.
idxis the location at which to insert value.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the caller graph for this function:

◆ leRectArray_RemoveDuplicates()

leResult leRectArray_RemoveDuplicates ( leRectArray arr)

Removes any duplicate rectangles from an array.

Removes all duplicates from arr.

Parameters
arrthe array to modify.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_RemoveOverlapping()

leResult leRectArray_RemoveOverlapping ( leRectArray arr)

Remove overlappping rectangles.

Removes overlapping rectangles in arr. The function first sorts the array by size then removes any rectangles that are completely overlapped by another larger rectangle.

Parameters
arrthe array to modify.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the call graph for this function:

◆ leRectArray_Resize()

leResult leRectArray_Resize ( leRectArray arr,
uint32_t  sz 
)

Resizes the capacity of the array.

Expands (or shrinks) an array arr to the specified sz.

If the array shrinks, any nodes beyond the new capacity will be discarded.

leArray* arr;
uint32_t sz;
leResult res = leArray_Resize(arr, sz)
Parameters
arrThe pointer to the array to resize.
szThe desired capacity.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_SortBySize()

leResult leRectArray_SortBySize ( leRectArray arr)

Sorts a given array.

Sorts values in arr from largest to smallest.

Parameters
arris the array to sort.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the caller graph for this function:

◆ leRectArray_SortByX()

leResult leRectArray_SortByX ( leRectArray arr)

Sort array by X coordinate.

Sorts the values in arr in order of the X coordinate.

Parameters
arrthe array to sort.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leRectArray_SortByY()

leResult leRectArray_SortByY ( leRectArray arr)

Sort array by Y coordinate.

Sorts the values in arr in order of the Y coordinate.

Parameters
arrthe array to analyze.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.