MPLABĀ® Harmony Graphics Suite
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 // *****************************************************************************
53 // *****************************************************************************
54 // Section: Routines
55 // *****************************************************************************
56 // *****************************************************************************
57 
58 // *****************************************************************************
72 LIB_EXPORT leBool leRectContainsPoint(const leRect* rect, const lePoint* point);
73 
74 // *****************************************************************************
88 LIB_EXPORT leBool leRectContainsRect(const leRect* l_rect, const leRect* r_rect);
89 
90 // *****************************************************************************
104 LIB_EXPORT leBool leRectIntersects(const leRect* l_rect, const leRect* r_rect);
105 
106 // *****************************************************************************
120 LIB_EXPORT leRect leRectCombine(const leRect* l_rect,
121  const leRect* r_rect);
122 
123 // *****************************************************************************
139 LIB_EXPORT void leRectClip(const leRect* l_rect,
140  const leRect* r_rect,
141  leRect* result);
142 
143 // *****************************************************************************
144 /* Function:
145  leRect leRectClipAdj(const leRect* l_rect,
146  const leRect* r_rect,
147  leRect* adj)
148 
149  Summary:
150  Returns the rectangle clipped using r_rect, and also adjusts the third rectangle
151 
152  Parameters:
153  const leRect* l_rect - the subject rectangle
154  const leRect* r_rect - the object rectangle
155  leRect* adj - the adjust rectangle
156 
157  Returns:
158  void
159 
160  Remarks:
161  result will equals l_rect if the rectangles aren't intersecting
162 
163 */
179 LIB_EXPORT leRect leRectClipAdj(const leRect* l_rect,
180  const leRect* r_rect,
181  leRect* adj);
182 
183 // *****************************************************************************
197 LIB_EXPORT leRect leRectFromPoints(const lePoint* p1,
198  const lePoint* p2);
199 
200 // *****************************************************************************
216 LIB_EXPORT void leRectToPoints(const leRect* rect,
217  lePoint* p1,
218  lePoint* p2);
219 
220 // *****************************************************************************
237 LIB_EXPORT uint32_t leRectSplit(const leRect* sub,
238  const leRect* obj,
239  leRect res[4]);
240 
241 // *****************************************************************************
256 LIB_EXPORT int32_t leRectCompare(const leRect* l,
257  const leRect* r);
258 
259 // *****************************************************************************
274 LIB_EXPORT leBool leRectsAreSimilar(const leRect* l,
275  const leRect* r);
276 static const leRect leRect_Zero = {0, 0, 0, 0};
286 #endif /* LE_RECT_H */
legato_math.h
Defines common math functions for general use.
leRectsAreSimilar
LIB_EXPORT leBool leRectsAreSimilar(const leRect *l, const leRect *r)
Determine if two rectanges are similar.
Definition: legato_rect.c:272
leRect
This struct represents a rectangle.
Definition: legato_common.h:405
leRectFromPoints
LIB_EXPORT leRect leRectFromPoints(const lePoint *p1, const lePoint *p2)
Create rectangle from two points.
Definition: legato_rect.c:151
leRectIntersects
LIB_EXPORT leBool leRectIntersects(const leRect *l_rect, const leRect *r_rect)
Determines if two rectangles are intersecting.
Definition: legato_rect.c:51
leMaxi
LIB_EXPORT int32_t leMaxi(int32_t l, int32_t r)
Calculate maximum of two integers.
Definition: legato_math.c:156
leRectCombine
LIB_EXPORT leRect leRectCombine(const leRect *l_rect, const leRect *r_rect)
Combine rectangles.
Definition: legato_rect.c:61
leBool
leBool
This enum represents booleans.
Definition: legato_common.h:157
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
leRectClipAdj
LIB_EXPORT leRect leRectClipAdj(const leRect *l_rect, const leRect *r_rect, leRect *adj)
Clips a rectangle to the space of another rectangle.
Definition: legato_rect.c:75
LE_FALSE
@ LE_FALSE
Definition: legato_common.h:158
leRectContainsPoint
LIB_EXPORT leBool leRectContainsPoint(const leRect *rect, const lePoint *point)
Determines if a point is inside a rectangle.
Definition: legato_rect.c:31
leMini
LIB_EXPORT int32_t leMini(int32_t l, int32_t r)
Calculate minimum of two integers.
Definition: legato_math.c:151
legato_rect.h
Rectangle functions and definitions.
leRectClip
LIB_EXPORT 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:122
leRectToPoints
LIB_EXPORT void leRectToPoints(const leRect *rect, lePoint *p1, lePoint *p2)
Create rectangle from two points.
Definition: legato_rect.c:188
LE_TRUE
@ LE_TRUE
Definition: legato_common.h:159
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
leRectCompare
LIB_EXPORT int32_t leRectCompare(const leRect *l, const leRect *r)
Determines if two rectangles are similar.
Definition: legato_rect.c:266
lePoint
This structure represents a integer Cartesian point.
Definition: legato_common.h:357