MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_rect.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_rect.h
32 
33  Summary:
34  Defines general purposes rectangle functions.
35 
36  Description:
37  Rectangle management functions.
38 *******************************************************************************/
39 
47 #ifndef LE_RECT_H
48 #define LE_RECT_H
49 
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 // *****************************************************************************
57 // *****************************************************************************
58 // Section: Routines
59 // *****************************************************************************
60 // *****************************************************************************
61 
62 // *****************************************************************************
76 leBool leRectContainsPoint(const leRect* rect, const lePoint* point);
77 
78 // *****************************************************************************
92 leBool leRectContainsRect(const leRect* l_rect, const leRect* r_rect);
93 
94 // *****************************************************************************
108 leBool leRectIntersects(const leRect* l_rect, const leRect* r_rect);
109 
110 // *****************************************************************************
126 void leRectCombine(const leRect* l_rect,
127  const leRect* r_rect,
128  leRect* res);
129 
130 // *****************************************************************************
146 void leRectClip(const leRect* l_rect,
147  const leRect* r_rect,
148  leRect* result);
149 
150 // *****************************************************************************
151 /* Function:
152  leRect leRectClipAdj(const leRect* l_rect,
153  const leRect* r_rect,
154  leRect* adj)
155 
156  Summary:
157  Returns the rectangle clipped using r_rect, and also adjusts the third rectangle
158 
159  Parameters:
160  const leRect* l_rect - the subject rectangle
161  const leRect* r_rect - the object rectangle
162  leRect* adj - the adjust rectangle
163 
164  Returns:
165  void
166 
167  Remarks:
168  result will equals l_rect if the rectangles aren't intersecting
169 
170 */
187 void leRectClipAdj(const leRect* l_rect,
188  const leRect* r_rect,
189  leRect* adj,
190  leRect* res);
191 
192 // *****************************************************************************
207 void leRectFromPoints(const lePoint* p1,
208  const lePoint* p2,
209  leRect* res);
210 
211 // *****************************************************************************
227 void leRectToPoints(const leRect* rect,
228  lePoint* p1,
229  lePoint* p2);
230 
231 // *****************************************************************************
248 uint32_t leRectSplit(const leRect* sub,
249  const leRect* obj,
250  leRect res[4]);
251 
252 // *****************************************************************************
267 int32_t leRectCompare(const leRect* l,
268  const leRect* r);
269 
270 // *****************************************************************************
286  const leRect* r);
287 static const leRect leRect_Zero = {0, 0, 0, 0};
297 #ifdef __cplusplus
298 }
299 #endif
300 
301 #endif /* LE_RECT_H */
uint32_t leRectSplit(const leRect *sub, const leRect *obj, leRect res[4])
Split rectangles.
Definition: legato_rect.c:198
Common macros and definitions used by Legato.
leBool leRectContainsPoint(const leRect *rect, const lePoint *point)
Determines if a point is inside a rectangle.
Definition: legato_rect.c:31
leBool leRectContainsRect(const leRect *l_rect, const leRect *r_rect)
Determines if a rectangle is completely inside another rectangle.
Definition: legato_rect.c:40
void leRectCombine(const leRect *l_rect, const leRect *r_rect, leRect *res)
Combine rectangles.
Definition: legato_rect.c:61
void leRectToPoints(const leRect *rect, lePoint *p1, lePoint *p2)
Create rectangle from two points.
Definition: legato_rect.c:188
void leRectClipAdj(const leRect *l_rect, const leRect *r_rect, leRect *adj, leRect *res)
Clips a rectangle to the space of another rectangle.
Definition: legato_rect.c:76
void leRectClip(const leRect *l_rect, const leRect *r_rect, leRect *result)
Clips a rectangle to the space of another rectangle.
Definition: legato_rect.c:124
This struct represents a rectangle.
Definition: legato_common.h:394
leBool leRectsAreSimilar(const leRect *l, const leRect *r)
Determine if two rectanges are similar.
Definition: legato_rect.c:272
This structure represents a integer Cartesian point.
Definition: legato_common.h:346
void leRectFromPoints(const lePoint *p1, const lePoint *p2, leRect *res)
Create rectangle from two points.
Definition: legato_rect.c:153
leBool
This enum represents booleans.
Definition: legato_common.h:146
int32_t leRectCompare(const leRect *l, const leRect *r)
Determines if two rectangles are similar.
Definition: legato_rect.c:266
leBool leRectIntersects(const leRect *l_rect, const leRect *r_rect)
Determines if two rectangles are intersecting.
Definition: legato_rect.c:51