microvg  8.0.0
microvg
vg_configuration.h
Go to the documentation of this file.
1 /*
2  * C
3  *
4  * Copyright 2020-2026 MicroEJ Corp. All rights reserved.
5  * MicroEJ Corp. PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */
7 
15 #ifndef VG_CONFIGURATION_H
16 #define VG_CONFIGURATION_H
17 
18 #if defined __cplusplus
19 extern "C" {
20 #endif
21 
22 // -----------------------------------------------------------------------------
23 // Includes
24 // -----------------------------------------------------------------------------
25 
26 // Include VEE Port User configuration file
27 // (already included in ui_configuration.h of UI Pack 14.5.0 and higher)
28 #if defined __has_include
29  #if __has_include("veeport_configuration.h")
30  #include "veeport_configuration.h"
31  #endif // __has_include("veeport_configuration.h")
32 #else
33 // Ensure 'veeport_configuration.h' exists in your project for custom configurations.
34  #include "veeport_configuration.h"
35 #endif // defined __has_include
36 
37 #include "ui_configuration.h"
38 
39 // -----------------------------------------------------------------------------
40 // MicroVG's Path Options
41 // -----------------------------------------------------------------------------
42 
43 /*
44  * @brief Value of "VG_FEATURE_PATH" to use only one array to store the path's
45  * commands and the commands' parameters.
46  */
47 #define VG_FEATURE_PATH_SINGLE_ARRAY (1)
48 
49 /*
50  * @brief Value of "VG_FEATURE_PATH" to use two arrays to store the path's data:
51  * one for the commands and one for the commands' parameters.
52  */
53 #define VG_FEATURE_PATH_DUAL_ARRAY (2)
54 
55 // -----------------------------------------------------------------------------
56 // MicroVG's LinearGradient Options
57 // -----------------------------------------------------------------------------
58 
59 /*
60  * @brief Value of "VG_FEATURE_GRADIENT" to use a full implementation of the
61  * MicroVG's LinearGradient.
62  *
63  * This implementation holds an array of all colors and positions set by the
64  * application.
65  */
66 #define VG_FEATURE_GRADIENT_FULL (1)
67 
68 /*
69  * @brief Value of "VG_FEATURE_GRADIENT" to use a reduced implementation of the
70  * MicroVG's LinearGradient.
71  *
72  * This implementation keeps only the first color set by the application when
73  * inializing a gradient.
74  */
75 #define VG_FEATURE_GRADIENT_FIRST_COLOR (2)
76 
77 // -----------------------------------------------------------------------------
78 // MicroVG's VectorFont Options
79 // -----------------------------------------------------------------------------
80 
81 /*
82  * @brief Value of "VG_FEATURE_FONT" to use FreeTYPE as implementation of the
83  * MicroVG's VectorFont.
84  *
85  * This implementation configures FreeTYPE to manipulate the font's glyphs as a
86  * succession of vector paths. It requires a "vector" renderer.
87  */
88 #define VG_FEATURE_FONT_FREETYPE_VECTOR (1)
89 
90 /*
91  * @brief Value of "VG_FEATURE_FONT" to use FreeTYPE as implementation of the
92  * MicroVG' VectorFont.
93  *
94  * This implementation configures FreeTYPE to manipulate the font's glyphs as
95  * bitmaps. No renderer is required
96  */
97 #define VG_FEATURE_FONT_FREETYPE_BITMAP (2)
98 
99 // -----------------------------------------------------------------------------
100 // MicroVG's Features Configuration
101 // -----------------------------------------------------------------------------
102 
103 /*
104  * @brief Set this define to embed the implementation of the MicroVG's
105  * Path (dynamic path creation and path rendering).
106  *
107  * This implementation holds the path's commands and paramters defined by the
108  * application. The define value specifies how this data is stored (one or two arrays).
109  *
110  * When not set, a stub implementation is used. No error is thrown at runtime when
111  * the application uses a path: the dynamic path are not created and the path
112  * rendering is not performed.
113  */
114 #ifndef VG_FEATURE_PATH
115 #define VG_FEATURE_PATH VG_FEATURE_PATH_SINGLE_ARRAY
116 #endif
117 
118 /*
119  * @brief Set this define to specify the implementation of the MicroVG's
120  * LinearGradient (dynamic gradient creation and drawings with gradient).
121  *
122  * @see VG_FEATURE_GRADIENT_FULL
123  * @see VG_FEATURE_GRADIENT_FIRST_COLOR
124  *
125  * When not set, a stub implementation is used. No error is thrown at runtime when
126  * the application uses a gradient: the dynamic gradient are not created and the
127  * gradient rendering is not performed.
128  */
129 #ifndef VG_FEATURE_GRADIENT
130 #define VG_FEATURE_GRADIENT VG_FEATURE_GRADIENT_FULL
131 #endif
132 
133 /*
134  * @brief Set this define to specify the implementation of the MicroVG'
135  * VectorFont (dynamic font loading and text rendering).
136  *
137  * @see VG_FEATURE_FONT_FREETYPE_VECTOR
138  * @see VG_FEATURE_FONT_FREETYPE_BITMAP
139  *
140  * When not set, a stub implementation is used. The application cannot load a font
141  * (and by consequence cannot draw a text).
142  */
143 #ifndef VG_FEATURE_FONT
144 #define VG_FEATURE_FONT VG_FEATURE_FONT_FREETYPE_VECTOR
145 #endif
146 
150 #ifndef VG_FEATURE_FREETYPE_TTF
151 #define VG_FEATURE_FREETYPE_TTF (0)
152 #endif
153 
157 #ifndef VG_FEATURE_FREETYPE_OTF
158 #define VG_FEATURE_FREETYPE_OTF (0)
159 #endif
160 
161 /*
162  * @brief Uncomment this define to enable the support of colored emoji.
163  */
164 #ifndef VG_FEATURE_FREETYPE_COLORED_EMOJI
165 #define VG_FEATURE_FREETYPE_COLORED_EMOJI (0)
166 #endif
167 
168 /*
169  * @brief Set this define to 1 to enable the support of complex layout (disabled by default).
170  *
171  * When set, the complex layout feature is disabled by default (the Freetype layout
172  * manager is used). See functions MICROVG_HELPER_set_complex_layout() and
173  * MICROVG_HELPER_has_complex_layouter().
174  *
175  * Note: the complex layout feature is managed by the Harfbuzz engine.
176  * Harfbuzz is used beside Freetype, thus the FT_CONFIG_OPTION_USE_HARFBUZZ define
177  * is not needed. This implementation has been chosen to ease the replacement of
178  * harfbuzz by an other complex layouter.
179  */
180 #ifndef VG_FEATURE_FONT_COMPLEX_LAYOUT
181 #define VG_FEATURE_FONT_COMPLEX_LAYOUT (0)
182 #endif
183 
184 /*
185  * @brief Set this define to 1 to enable the support of external font files (disabled by default).
186  *
187  * When a font file is not available in the application classpath, the implementation tries to
188  * load it from an external resource system.
189  *
190  * The VEE Port must embed the module "External Resource" and the BSP must implement
191  * "LLEXT_RES_impl.h" header file.
192  *
193  * When not set, only the resources compiled with the application are used.
194  */
195 #ifndef VG_FEATURE_FONT_EXTERNAL
196 #define VG_FEATURE_FONT_EXTERNAL (0)
197 #endif
198 
199 /*
200  * @brief Configure this define to set the freetype heap size.
201  *
202  * The freetype heap size depends on the font used by the application
203  * @see MICROVG_MONITOR_HEAP in vg_helper.h to monitor the heap usage evolution.
204  */
205 #ifndef VG_FEATURE_FREETYPE_HEAP_SIZE
206 #define VG_FEATURE_FREETYPE_HEAP_SIZE (80 * 1024)
207 #endif
208 
209 /*
210  * @brief Configure this define to set the complex layouter heap size.
211  *
212  * @see VG_FEATURE_FONT_COMPLEX_LAYOUT
213  *
214  * The complex layouter heap size depends on the font used by the application
215  * @see MICROVG_MONITOR_HEAP in vg_helper.h to monitor the heap usage evolution.
216  */
217 #ifdef VG_FEATURE_FONT_COMPLEX_LAYOUT
218 #define VG_FEATURE_FONT_COMPLEX_LAYOUT_HEAP_SIZE (80 * 1024)
219 #endif
220 
221 #if defined(UI_GC_SUPPORTED_FORMATS) && (UI_GC_SUPPORTED_FORMATS > 1)
222 
223 /*
224  * @brief Set this define to 1 to enable the support of MicroVG BufferedVectorImage
225  * (disabled by default).
226  *
227  * This feature requires the available number of supported GraphicsContext formats
228  * is higher than 1.
229  */
230 #ifndef VG_FEATURE_BUFFERED_VECTOR_IMAGE
231 #define VG_FEATURE_BUFFERED_VECTOR_IMAGE (0)
232 #endif
233 
234 /*
235  * @brief The drawing functions to target the BufferedVectorImage have by default the
236  * identifier 1.
237  */
238 #ifndef UI_DRAWING_IDENTIFIER_BVI_FORMAT
239 #define UI_DRAWING_IDENTIFIER_BVI_FORMAT 1
240 #endif
241 
242 #elif defined(VG_FEATURE_BUFFERED_VECTOR_IMAGE)
243 #error "The BufferedVectorImage feature requires the support of several Graphics Context formats".
244 #endif // if defined(UI_GC_SUPPORTED_FORMATS) && (UI_GC_SUPPORTED_FORMATS > 1)
245 
246 // -----------------------------------------------------------------------------
247 // EOF
248 // -----------------------------------------------------------------------------
249 
250 #ifdef __cplusplus
251 }
252 #endif
253 
254 #endif // !defined VG_CONFIGURATION_H