MPLABĀ® Harmony Graphics Suite
legato_string_renderer.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 
31 #ifndef LE_STRING_RENDERER_H
32 #define LE_STRING_RENDERER_H
33 
35 
36 // *****************************************************************************
37 /* Structure:
38  struct leStringRenderRequest
39 
40  Summary:
41  Defines the arguments necessary to perform an leString draw operation
42 
43  Description:
44  const leString* str - the string to draw
45  int32_t x - the x position in screen space
46  int32_t y - the y position in screen space
47  leHAlignment align - the alignment of the string
48  leColor color - the color to write
49  uint32_t alpha - global alpha value to apply
50 
51  Remarks:
52  None.
53 */
58 typedef struct leStringRenderRequest
59 {
60  const leString* str;
61  int32_t x;
62  int32_t y;
63  leHAlignment align;
64  leColor color;
65  uint32_t alpha;
67 
68 // *****************************************************************************
69 /* Structure:
70  struct leUStringRenderRequest
71 
72  Summary:
73  Defines the arguments necessary to perform an leChar string draw operation
74 
75  Description:
76  const leChar* str - the string buffer to draw
77  uint32_t length - the length of the string in leChar
78  const leFont* font - the font to reference for rendering
79  int32_t x - the x position in screen space
80  int32_t y - the y position in screen space
81  leHAlignment align - the alignment of the string
82  leColor color - the color to write
83  uint32_t alpha - global alpha value to apply
84 
85  Remarks:
86  None.
87 */
92 typedef struct leUStringRenderRequest
93 {
94  const leChar* str;
95  uint32_t length;
96  const leFont* font;
97  int32_t x;
98  int32_t y;
99  leHAlignment align;
100  leColor color;
101  uint32_t alpha;
103 
104 // *****************************************************************************
105 /* Structure:
106  struct leCStringRenderRequest
107 
108  Summary:
109  Defines the arguments necessary to perform a C-style string draw operation
110 
111  Description:
112  const char* str - the c string buffer to draw
113  const leFont* font - the font to reference for rendering
114  int32_t x - the x position in screen space
115  int32_t y - the y position in screen space
116  leHAlignment align - the alignment of the string
117  leColor color - the color to write
118  uint32_t alpha - global alpha value to apply
119 
120  Remarks:
121  None.
122 */
128 {
129  const char* str;
130  const leFont* font;
131  int32_t x;
132  int32_t y;
133  leHAlignment align;
134  leColor color;
135  uint32_t alpha;
137 
138 // *****************************************************************************
150 
151 // *****************************************************************************
163 
164 // *****************************************************************************
176 
177 #endif /* LE_STRING_RENDERER_H */
LE_HALIGN_RIGHT
@ LE_HALIGN_RIGHT
Definition: legato_common.h:209
leResult
leResult
This enum represents function call results.
Definition: legato_common.h:134
leRect
This struct represents a rectangle.
Definition: legato_common.h:405
leStringUtils_GetRect
LIB_EXPORT leResult leStringUtils_GetRect(const leChar *str, uint32_t size, const leFont *font, leRect *rect)
Get bounding rectangle for a leChar style string.
Definition: legato_stringutils.c:86
leStringRenderer_DrawString
leResult leStringRenderer_DrawString(leStringRenderRequest *req)
Draw an leString.
Definition: legato_string_renderer.c:114
leHAlignment
leHAlignment
This enum represents the horizontal alignment mode of objects.
Definition: legato_common.h:206
legato_string_renderer.h
String Renderer.
leStringUtils_GetLineRectCStr
LIB_EXPORT leResult leStringUtils_GetLineRectCStr(const char *str, const leFont *font, uint32_t line, leRect *rect)
Gets the line bounding rectangle for a C-style string.
Definition: legato_stringutils.c:347
leStreamDescriptor::location
uint32_t location
Definition: legato_stream.h:58
leStringRenderRequest
struct leStringRenderRequest leStringRenderRequest
This struct represents a string render request.
LE_HALIGN_CENTER
@ LE_HALIGN_CENTER
Definition: legato_common.h:208
leStringUtils_GetLineCountCStr
LIB_EXPORT uint32_t leStringUtils_GetLineCountCStr(const char *str)
Get line count for a C-style string.
Definition: legato_stringutils.c:194
leFont
This struct represents a font object.
Definition: legato_font.h:136
leRasterFont
This struct represents a rasterized font object.
Definition: legato_font.h:167
leString
This struct represents a string.
Definition: legato_string.h:108
leFont_DrawGlyph
leResult leFont_DrawGlyph(const leFont *fnt, const leFontGlyph *glyph, int32_t x, int32_t y, leColor clr, uint32_t a)
Draws a glyph.
Definition: legato_font.c:349
LE_STREAM_LOCATION_ID_INTERNAL
#define LE_STREAM_LOCATION_ID_INTERNAL
leEventResult
Definition: legato_stream.h:67
leStringRenderRequest
This struct represents a string render request.
Definition: legato_string_renderer.h:59
leStringRenderer_DrawUString
leResult leStringRenderer_DrawUString(leUStringRenderRequest *req)
Draw C-Style string.
Definition: legato_string_renderer.c:206
leFontGlyph
This struct represents a font glyph.
Definition: legato_font.h:90
leStringUtils_GetLineCount
LIB_EXPORT uint32_t leStringUtils_GetLineCount(const leChar *str, uint32_t size)
Get line count for a leChar style string.
Definition: legato_stringutils.c:172
legato_string.h
Fixed string functions and definitions.
leFont_GetGlyphInfo
leResult leFont_GetGlyphInfo(const leFont *fnt, uint32_t codepoint, leFontGlyph *glyph)
Get glyph info.
Definition: legato_font.c:171
leCStringRenderRequest
This struct represents a c-style string render request.
Definition: legato_string_renderer.h:128
legato_stringutils.h
String utility functions and definitions.
leUStringRenderRequest
This struct represents a lechar string render request.
Definition: legato_string_renderer.h:93
leStringUtils_GetLineIndices
LIB_EXPORT leResult leStringUtils_GetLineIndices(const leChar *str, uint32_t size, uint32_t line, uint32_t *start, uint32_t *end)
Get line indices for a leChar style string.
Definition: legato_stringutils.c:221
leCStringRenderRequest
struct leCStringRenderRequest leCStringRenderRequest
This struct represents a c-style string render request.
leStringUtils_GetLineIndicesCStr
LIB_EXPORT leResult leStringUtils_GetLineIndicesCStr(const char *str, uint32_t line, uint32_t *start, uint32_t *end)
Gets the line indices for a C-style string.
Definition: legato_stringutils.c:262
leStringUtils_GetLineRect
LIB_EXPORT leResult leStringUtils_GetLineRect(const leChar *str, uint32_t size, const leFont *font, uint32_t line, leRect *rect)
Gets the line bounding rectangle for a leChar style string.
Definition: legato_stringutils.c:305
leChar
uint16_t leChar
This typedef represents Legato character.
Definition: legato_common.h:424
leStringRenderer_DrawCString
leResult leStringRenderer_DrawCString(leCStringRenderRequest *req)
Draw leChar string.
Definition: legato_string_renderer.c:297
leUStringRenderRequest
struct leUStringRenderRequest leUStringRenderRequest
This struct represents a lechar string render request.
leString::fn
const leStringVTable * fn
Definition: legato_string.h:109
leStringUtils_GetRectCStr
LIB_EXPORT leResult leStringUtils_GetRectCStr(const char *str, const leFont *font, leRect *rect)
Gets the bounding rectangle for a C-style string.
Definition: legato_stringutils.c:128