MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
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 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 // *****************************************************************************
60 /* Structure:
61  leRectArray
62 
63  Summary:
64  Rectangle array definition
65 
66  Remarks:
67  None.
68 */
69 
74 typedef struct leRectArray
75 {
77  uint32_t size;
78  uint32_t capacity;
79 } leRectArray;
80 
81 // *****************************************************************************
82 
94 
95 
96 // *****************************************************************************
97 
115 leResult leRectArray_Resize(leRectArray* arr, uint32_t sz);
116 
117 // *****************************************************************************
133  const leRect* rect);
134 
135 // *****************************************************************************
149 
150 // *****************************************************************************
165 
166 // *****************************************************************************
179 
180 // *****************************************************************************
199  uint32_t idx,
200  const leRect* rect);
201 
202 // *****************************************************************************
216 leResult leRectArray_RemoveAt(leRectArray* arr, uint32_t idx);
217 
218 // *****************************************************************************
233 
234 // *****************************************************************************
247 
248 // *****************************************************************************
260 
261 
262 // *****************************************************************************
274 
275 // *****************************************************************************
287 
288 // *****************************************************************************
301 
302 // *****************************************************************************
315 
316 // *****************************************************************************
328 
329 // *****************************************************************************
343 
344 #if LE_SCRATCH_BUFFER_PADDING == 1
345 
356 leResult leRectArray_PadRectangles(leRectArray* arr);
357 
370 leResult leRectArray_PadRectangleWidth(leRectArray* arr,
371  uint32_t size);
372 
385 leResult leRectArray_PadRectangleHeight(leRectArray* arr,
386  uint32_t size);
387 #endif
388 
389 // *****************************************************************************
409  uint32_t width,
410  uint32_t height);
411 
412 
413 // *****************************************************************************
430 
431 // *****************************************************************************
448 
449 #ifdef __cplusplus
450 }
451 #endif
452 
453 #endif /* LEGATO_RECTARRAY_H */
This struct represents a rectange array.
Definition: legato_rectarray.h:74
leResult leRectArray_Destroy(leRectArray *arr)
Destroy array.
Definition: legato_rectarray.c:240
uint32_t size
Definition: legato_rectarray.h:77
uint32_t capacity
Definition: legato_rectarray.h:78
Common macros and definitions used by Legato.
leResult leRectArray_Resize(leRectArray *arr, uint32_t sz)
Resizes the capacity of the array.
Definition: legato_rectarray.c:94
leResult leRectArray_CropToSizeX(leRectArray *arr, uint32_t size)
Slices an array of rectangles to a given pixel count.
Definition: legato_rectarray.c:564
leResult leRectArray_SortBySize(leRectArray *arr)
Sorts a given array.
Definition: legato_rectarray.c:281
leResult leRectArray_PushFront(leRectArray *arr, const leRect *rect)
Pushes a new rectangle onto the front of the array.
Definition: legato_rectarray.c:121
leResult leRectArray_PopBack(leRectArray *arr)
Removes the last rectangle from the array.
Definition: legato_rectarray.c:166
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
leResult leRectArray_Copy(leRectArray *src, leRectArray *dest)
Copy array.
Definition: legato_rectarray.c:209
leResult leRectArray_CropToArea(leRectArray *arr, uint32_t width, uint32_t height)
Crops rectange by width and height.
Definition: legato_rectarray.c:492
leResult
This enum represents function call results.
Definition: legato_common.h:123
leResult leRectArray_MergeSimilar(leRectArray *arr)
Merge rectangles.
Definition: legato_rectarray.c:371
leResult leRectArray_SortByY(leRectArray *arr)
Sort array by Y coordinate.
Definition: legato_rectarray.c:341
This struct represents a rectangle.
Definition: legato_common.h:394
leResult leRectArray_PopFront(leRectArray *arr)
Removes the first value from the array.
Definition: legato_rectarray.c:139
struct leRectArray leRectArray
This struct represents a rectange array.
leResult leRectArray_RemoveAt(leRectArray *arr, uint32_t idx)
Removes a rectangle from the array at an index.
Definition: legato_rectarray.c:199
leResult leRectArray_RemoveOverlapping(leRectArray *arr)
Remove overlappping rectangles.
Definition: legato_rectarray.c:395
leResult leRectArray_RemoveDuplicates(leRectArray *arr)
Removes any duplicate rectangles from an array.
Definition: legato_rectarray.c:258
leResult leRectArray_CropToSizeY(leRectArray *arr, uint32_t size)
Slices an array of rectangles to a given pixel count.
Definition: legato_rectarray.c:524
leResult leRectArray_SortByX(leRectArray *arr)
Sort array by X coordinate.
Definition: legato_rectarray.c:311
leResult leRectArray_PushBack(leRectArray *arr, const leRect *rect)
Push value on back.
Definition: legato_rectarray.c:149
leRect * rects
Definition: legato_rectarray.h:76
leResult leRectArray_Clear(leRectArray *arr)
Removes all values from a given array.
Definition: legato_rectarray.c:230
leResult leRectArray_Create(leRectArray *arr)
Creates a new rectangle.
Definition: legato_rectarray.c:82