MPLABĀ® Harmony Graphics Suite
legato_rectarray.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
24 /*******************************************************************************
25  Module for Microchip Graphics Library - Legato User Interface Library
26 
27  Company:
28  Microchip Technology Inc.
29 
30  File Name:
31  legato_rectarray.h
32 
33  Summary:
34  An array implementation for storing rectangles for the
35  Legato user interface library
36 
37  Description:
38  This is an array implementation that is used internally by the
39  Legato user interface library.
40 *******************************************************************************/
41 
50 #ifndef LEGATO_RECTARRAY_H
51 #define LEGATO_RECTARRAY_H
52 
54 
55 // *****************************************************************************
56 /* Structure:
57  leRectArray
58 
59  Summary:
60  Rectangle array definition
61 
62  Remarks:
63  None.
64 */
65 
70 typedef struct leRectArray
71 {
73  uint32_t size;
74  uint32_t capacity;
76 
77 // *****************************************************************************
78 
89 LIB_EXPORT leResult leRectArray_Create(leRectArray* arr);
90 
91 
92 // *****************************************************************************
93 
111 LIB_EXPORT leResult leRectArray_Resize(leRectArray* arr, uint32_t sz);
112 
113 // *****************************************************************************
129  const leRect* rect);
130 
131 // *****************************************************************************
144 LIB_EXPORT leResult leRectArray_PopFront(leRectArray* arr);
145 
146 // *****************************************************************************
160 LIB_EXPORT leResult leRectArray_PushBack(leRectArray* arr, const leRect* rect);
161 
162 // *****************************************************************************
174 LIB_EXPORT leResult leRectArray_PopBack(leRectArray* arr);
175 
176 // *****************************************************************************
195  uint32_t idx,
196  const leRect* rect);
197 
198 // *****************************************************************************
212 LIB_EXPORT leResult leRectArray_RemoveAt(leRectArray* arr, uint32_t idx);
213 
214 // *****************************************************************************
228 LIB_EXPORT leResult leRectArray_Copy(leRectArray* src, leRectArray* dest);
229 
230 // *****************************************************************************
242 LIB_EXPORT leResult leRectArray_Clear(leRectArray* arr);
243 
244 // *****************************************************************************
255 LIB_EXPORT leResult leRectArray_Destroy(leRectArray* arr);
256 
257 
258 // *****************************************************************************
270 
271 // *****************************************************************************
283 
284 // *****************************************************************************
296 LIB_EXPORT leResult leRectArray_SortByX(leRectArray* arr);
297 
298 // *****************************************************************************
310 LIB_EXPORT leResult leRectArray_SortByY(leRectArray* arr);
311 
312 // *****************************************************************************
324 
325 // *****************************************************************************
339 
340 // *****************************************************************************
360  uint32_t width,
361  uint32_t height);
362 
363 
364 // *****************************************************************************
380 leResult leRectArray_CropToSizeY(leRectArray* arr, uint32_t size);
381 
382 // *****************************************************************************
398 leResult leRectArray_CropToSizeX(leRectArray* arr, uint32_t size);
399 
400 #endif /* LEGATO_RECTARRAY_H */
legato_error.h
Error functions, macros and definitions.
leRectsAreSimilar
LIB_EXPORT leBool leRectsAreSimilar(const leRect *l, const leRect *r)
Determine if two rectanges are similar.
Definition: legato_rect.c:272
leResult
leResult
This enum represents function call results.
Definition: legato_common.h:134
leRect
This struct represents a rectangle.
Definition: legato_common.h:405
leRectArray::capacity
uint32_t capacity
Definition: legato_rectarray.h:74
leRectArray
struct leRectArray leRectArray
This struct represents a rectange array.
legato_memory.h
Memory functions and definitions.
leRectArray::rects
leRect * rects
Definition: legato_rectarray.h:72
leRectArray_RemoveDuplicates
LIB_EXPORT leResult leRectArray_RemoveDuplicates(leRectArray *arr)
Removes any duplicate rectangles from an array.
Definition: legato_rectarray.c:258
leRectArray_PopFront
LIB_EXPORT leResult leRectArray_PopFront(leRectArray *arr)
Removes the first value from the array.
Definition: legato_rectarray.c:139
leRectArray_MergeSimilar
LIB_EXPORT leResult leRectArray_MergeSimilar(leRectArray *arr)
Merge rectangles.
Definition: legato_rectarray.c:371
leRectArray_RemoveOverlapping
LIB_EXPORT leResult leRectArray_RemoveOverlapping(leRectArray *arr)
Remove overlappping rectangles.
Definition: legato_rectarray.c:393
leRectArray_RemoveAt
LIB_EXPORT leResult leRectArray_RemoveAt(leRectArray *arr, uint32_t idx)
Removes a rectangle from the array at an index.
Definition: legato_rectarray.c:199
leRectArray
This struct represents a rectange array.
Definition: legato_rectarray.h:71
leRectCombine
LIB_EXPORT leRect leRectCombine(const leRect *l_rect, const leRect *r_rect)
Combine rectangles.
Definition: legato_rect.c:61
leRectArray_CropToArea
LIB_EXPORT leResult leRectArray_CropToArea(leRectArray *arr, uint32_t width, uint32_t height)
Crops rectange by width and height.
Definition: legato_rectarray.c:415
leRectArray_PopBack
LIB_EXPORT leResult leRectArray_PopBack(leRectArray *arr)
Removes the last rectangle from the array.
Definition: legato_rectarray.c:166
legato_rectarray.h
An array implementation for storing rectangles for the Legato user interface library.
leRectArray_Create
LIB_EXPORT leResult leRectArray_Create(leRectArray *arr)
Creates a new rectangle.
Definition: legato_rectarray.c:82
leRectContainsRect
LIB_EXPORT leBool leRectContainsRect(const leRect *l_rect, const leRect *r_rect)
Determines if a rectangle is completely inside another rectangle.
Definition: legato_rect.c:40
leRectArray_SortByX
LIB_EXPORT leResult leRectArray_SortByX(leRectArray *arr)
Sort array by X coordinate.
Definition: legato_rectarray.c:311
leRectArray_SortByY
LIB_EXPORT leResult leRectArray_SortByY(leRectArray *arr)
Sort array by Y coordinate.
Definition: legato_rectarray.c:341
leRectArray_Clear
LIB_EXPORT leResult leRectArray_Clear(leRectArray *arr)
Removes all values from a given array.
Definition: legato_rectarray.c:230
leRectArray_CropToSizeX
leResult leRectArray_CropToSizeX(leRectArray *arr, uint32_t size)
Slices an array of rectangles to a given pixel count.
Definition: legato_rectarray.c:487
legato_rect.h
Rectangle functions and definitions.
leRectArray_InsertAt
LIB_EXPORT leResult leRectArray_InsertAt(leRectArray *arr, uint32_t idx, const leRect *rect)
Inserts a rectangle into an array at a given index.
Definition: legato_rectarray.c:176
leRectArray_PushFront
LIB_EXPORT leResult leRectArray_PushFront(leRectArray *arr, const leRect *rect)
Pushes a new rectangle onto the front of the array.
Definition: legato_rectarray.c:121
leRectArray_Resize
LIB_EXPORT leResult leRectArray_Resize(leRectArray *arr, uint32_t sz)
Resizes the capacity of the array.
Definition: legato_rectarray.c:94
leRectArray_Destroy
LIB_EXPORT leResult leRectArray_Destroy(leRectArray *arr)
Destroy array.
Definition: legato_rectarray.c:240
leRectArray::size
uint32_t size
Definition: legato_rectarray.h:73
LE_TRUE
@ LE_TRUE
Definition: legato_common.h:159
leRectArray_SortBySize
LIB_EXPORT leResult leRectArray_SortBySize(leRectArray *arr)
Sorts a given array.
Definition: legato_rectarray.c:281
legato_common.h
Common macros and definitions used by Legato.
leRectSplit
LIB_EXPORT uint32_t leRectSplit(const leRect *sub, const leRect *obj, leRect res[4])
Split rectangles.
Definition: legato_rect.c:198
leRectArray_PushBack
LIB_EXPORT leResult leRectArray_PushBack(leRectArray *arr, const leRect *rect)
Push value on back.
Definition: legato_rectarray.c:149
leRectArray_CropToSizeY
leResult leRectArray_CropToSizeY(leRectArray *arr, uint32_t size)
Slices an array of rectangles to a given pixel count.
Definition: legato_rectarray.c:447
leRectCompare
LIB_EXPORT int32_t leRectCompare(const leRect *l, const leRect *r)
Determines if two rectangles are similar.
Definition: legato_rect.c:266
leRectArray_Copy
LIB_EXPORT leResult leRectArray_Copy(leRectArray *src, leRectArray *dest)
Copy array.
Definition: legato_rectarray.c:209