microvg  5.0.0
microvg
ui_drawing_bvi.h
1 /*
2  * Copyright 2023-2024 MicroEJ Corp. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be found with this software.
4  */
5 
6 #if !defined UI_DRAWING_BVI_H
7 #define UI_DRAWING_BVI_H
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /*
13  * @file
14  * @brief Implementation of a set of ui_drawing.h drawing functions (MicroUI and
15  * Drawing libraries). These are implementations over a BufferedVectorImage and
16  * the destination buffer format is the BufferedVectorImage format. When the drawing
17  * cannot be performed for any reason, the stub implementation is used instead.
18  * @author MicroEJ Developer Team
19  * @version 5.0.0
20  */
21 
22 #include "microvg_configuration.h"
23 #if defined VG_FEATURE_BUFFERED_VECTOR_IMAGE
24 
25 // --------------------------------------------------------------------------------
26 // Includes
27 // --------------------------------------------------------------------------------
28 
29 #include <LLVG_BVI_impl.h>
30 
31 #include "ui_drawing.h"
32 
33 // --------------------------------------------------------------------------------
34 // Defines
35 // --------------------------------------------------------------------------------
36 
37 /*
38  * @brief Redirects all ui_drawing.h functions to the BufferedVectorImage functions
39  */
40 
41 #define UI_DRAWING_BVI_is_drawer CONCAT(UI_DRAWING_is_drawer_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
42 #define UI_DRAWING_BVI_adjustNewImageCharacteristics CONCAT(UI_DRAWING_adjustNewImageCharacteristics_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
43 #define UI_DRAWING_BVI_initializeNewImage CONCAT(UI_DRAWING_initializeNewImage_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
44 #define UI_DRAWING_BVI_freeImageResources CONCAT(UI_DRAWING_freeImageResources_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
45 
46 #define UI_DRAWING_BVI_drawLine CONCAT(UI_DRAWING_drawLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
47 #define UI_DRAWING_BVI_drawHorizontalLine CONCAT(UI_DRAWING_drawHorizontalLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
48 #define UI_DRAWING_BVI_drawVerticalLine CONCAT(UI_DRAWING_drawVerticalLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
49 #define UI_DRAWING_BVI_fillRectangle CONCAT(UI_DRAWING_fillRectangle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
50 #define UI_DRAWING_BVI_drawRoundedRectangle CONCAT(UI_DRAWING_drawRoundedRectangle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
51 #define UI_DRAWING_BVI_fillRoundedRectangle CONCAT(UI_DRAWING_fillRoundedRectangle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
52 #define UI_DRAWING_BVI_drawCircleArc CONCAT(UI_DRAWING_drawCircleArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
53 #define UI_DRAWING_BVI_drawEllipseArc CONCAT(UI_DRAWING_drawEllipseArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
54 #define UI_DRAWING_BVI_fillCircleArc CONCAT(UI_DRAWING_fillCircleArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
55 #define UI_DRAWING_BVI_fillEllipseArc CONCAT(UI_DRAWING_fillEllipseArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
56 #define UI_DRAWING_BVI_drawEllipse CONCAT(UI_DRAWING_drawEllipse_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
57 #define UI_DRAWING_BVI_fillEllipse CONCAT(UI_DRAWING_fillEllipse_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
58 #define UI_DRAWING_BVI_drawCircle CONCAT(UI_DRAWING_drawCircle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
59 #define UI_DRAWING_BVI_fillCircle CONCAT(UI_DRAWING_fillCircle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
60 #define UI_DRAWING_BVI_drawThickFadedPoint CONCAT(UI_DRAWING_drawThickFadedPoint_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
61 #define UI_DRAWING_BVI_drawThickFadedLine CONCAT(UI_DRAWING_drawThickFadedLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
62 #define UI_DRAWING_BVI_drawThickFadedCircle CONCAT(UI_DRAWING_drawThickFadedCircle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
63 #define UI_DRAWING_BVI_drawThickFadedCircleArc CONCAT(UI_DRAWING_drawThickFadedCircleArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
64 #define UI_DRAWING_BVI_drawThickFadedEllipse CONCAT(UI_DRAWING_drawThickFadedEllipse_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
65 #define UI_DRAWING_BVI_drawThickLine CONCAT(UI_DRAWING_drawThickLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
66 #define UI_DRAWING_BVI_drawThickCircle CONCAT(UI_DRAWING_drawThickCircle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
67 #define UI_DRAWING_BVI_drawThickEllipse CONCAT(UI_DRAWING_drawThickEllipse_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
68 #define UI_DRAWING_BVI_drawThickCircleArc CONCAT(UI_DRAWING_drawThickCircleArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
69 
70 // --------------------------------------------------------------------------------
71 // ui_drawing.h API
72 // (the function names differ according to the available number of destination formats)
73 // --------------------------------------------------------------------------------
74 
75 /*
76  * @brief Implementation of adjustNewImageCharacteristics for a BufferedVectorImage. See ui_drawing.h
77  */
78 void UI_DRAWING_BVI_adjustNewImageCharacteristics(jbyte image_format, uint32_t width, uint32_t height, uint32_t* data_size, uint32_t* data_alignment);
79 
80 /*
81  * @brief Implementation of initializeNewImage for a BufferedVectorImage. See ui_drawing.h
82  */
83 void UI_DRAWING_BVI_initializeNewImage(MICROUI_Image* image);
84 
85 /*
86  * @brief Implementation of freeImageResources for a BufferedVectorImage. See ui_drawing.h
87  */
88 void UI_DRAWING_BVI_freeImageResources(MICROUI_Image* image) ;
89 
90 /*
91  * @brief Implementation of drawLine over a BufferedVectorImage. See ui_drawing.h
92  */
93 DRAWING_Status UI_DRAWING_BVI_drawLine(MICROUI_GraphicsContext* gc, jint startX, jint startY, jint endX, jint endY);
94 
95 /*
96  * @brief Implementation of drawHorizontalLine over a BufferedVectorImage. See ui_drawing.h
97  */
98 DRAWING_Status UI_DRAWING_BVI_drawHorizontalLine(MICROUI_GraphicsContext* gc, jint x1, jint x2, jint y);
99 
100 /*
101  * @brief Implementation of drawVerticalLine over a BufferedVectorImage. See ui_drawing.h
102  */
103 DRAWING_Status UI_DRAWING_BVI_drawVerticalLine(MICROUI_GraphicsContext* gc, jint x, jint y1, jint y2);
104 
105 /*
106  * @brief Implementation of fillRectangle over a BufferedVectorImage. See ui_drawing.h
107  */
108 DRAWING_Status UI_DRAWING_BVI_fillRectangle(MICROUI_GraphicsContext* gc, jint x1, jint y1, jint x2, jint y2);
109 
110 /*
111  * @brief Implementation of drawRoundedRectangle over a BufferedVectorImage. See ui_drawing.h
112  */
113 DRAWING_Status UI_DRAWING_BVI_drawRoundedRectangle(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jint cornerEllipseWidth, jint cornerEllipseHeight);
114 
115 /*
116  * @brief Implementation of fillRoundedRectangle over a BufferedVectorImage. See ui_drawing.h
117  */
118 DRAWING_Status UI_DRAWING_BVI_fillRoundedRectangle(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jint cornerEllipseWidth, jint cornerEllipseHeight);
119 
120 /*
121  * @brief Implementation of drawCircleArc over a BufferedVectorImage. See ui_drawing.h
122  */
123 DRAWING_Status UI_DRAWING_BVI_drawCircleArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jfloat startAngle, jfloat arcAngle);
124 
125 /*
126  * @brief Implementation of drawEllipseArc over a BufferedVectorImage. See ui_drawing.h
127  */
128 DRAWING_Status UI_DRAWING_BVI_drawEllipseArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jfloat startAngle, jfloat arcAngle);
129 
130 /*
131  * @brief Implementation of fillCircleArc over a BufferedVectorImage. See ui_drawing.h
132  */
133 DRAWING_Status UI_DRAWING_BVI_fillCircleArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jfloat startAngle, jfloat arcAngle);
134 
135 /*
136  * @brief Implementation of fillEllipseArc over a BufferedVectorImage. See ui_drawing.h
137  */
138 DRAWING_Status UI_DRAWING_BVI_fillEllipseArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jfloat startAngle, jfloat arcAngle);
139 
140 /*
141  * @brief Implementation of drawEllipse over a BufferedVectorImage. See ui_drawing.h
142  */
143 DRAWING_Status UI_DRAWING_BVI_drawEllipse(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height);
144 
145 /*
146  * @brief Implementation of fillEllipse over a BufferedVectorImage. See ui_drawing.h
147  */
148 DRAWING_Status UI_DRAWING_BVI_fillEllipse(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height);
149 
150 /*
151  * @brief Implementation of drawCircle over a BufferedVectorImage. See ui_drawing.h
152  */
153 DRAWING_Status UI_DRAWING_BVI_drawCircle(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter);
154 
155 /*
156  * @brief Implementation of fillCircle over a BufferedVectorImage. See ui_drawing.h
157  */
158 DRAWING_Status UI_DRAWING_BVI_fillCircle(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter);
159 
160 /*
161  * @brief Implementation of drawImage over a BufferedVectorImage. See ui_drawing.h
162  */
163 DRAWING_Status UI_DRAWING_BVI_drawImage(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint regionX, jint regionY, jint width, jint height, jint x, jint y, jint alpha);
164 
165 /*
166  * @brief Implementation of copyImage over a BufferedVectorImage. See ui_drawing.h
167  */
168 DRAWING_Status UI_DRAWING_BVI_copyImage(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint regionX, jint regionY, jint width, jint height, jint x, jint y);
169 
170 /*
171  * @brief Implementation of drawRegion over a BufferedVectorImage. See ui_drawing.h
172  */
173 DRAWING_Status UI_DRAWING_BVI_drawRegion(MICROUI_GraphicsContext* gc, jint regionX, jint regionY, jint width, jint height, jint x, jint y, jint alpha);
174 
175 /*
176  * @brief Implementation of drawThickFadedPoint over a BufferedVectorImage. See ui_drawing.h
177  */
178 DRAWING_Status UI_DRAWING_BVI_drawThickFadedPoint(MICROUI_GraphicsContext* gc, jint x, jint y, jint thickness, jint fade);
179 
180 /*
181  * @brief Implementation of drawThickFadedLine over a BufferedVectorImage. See ui_drawing.h
182  */
183 DRAWING_Status UI_DRAWING_BVI_drawThickFadedLine(MICROUI_GraphicsContext* gc, jint startX, jint startY, jint endX, jint endY, jint thickness, jint fade, DRAWING_Cap startCap, DRAWING_Cap endCap);
184 
185 /*
186  * @brief Implementation of drawThickFadedCircle over a BufferedVectorImage. See ui_drawing.h
187  */
188 DRAWING_Status UI_DRAWING_BVI_drawThickFadedCircle(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jint thickness, jint fade);
189 
190 /*
191  * @brief Implementation of drawThickFadedCircleArc over a BufferedVectorImage. See ui_drawing.h
192  */
193 DRAWING_Status UI_DRAWING_BVI_drawThickFadedCircleArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jfloat startAngle, jfloat arcAngle, jint thickness, jint fade, DRAWING_Cap start, DRAWING_Cap end);
194 
195 /*
196  * @brief Implementation of drawThickFadedEllipse over a BufferedVectorImage. See ui_drawing.h
197  */
198 DRAWING_Status UI_DRAWING_BVI_drawThickFadedEllipse(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jint thickness, jint fade);
199 
200 /*
201  * @brief Implementation of drawThickLine over a BufferedVectorImage. See ui_drawing.h
202  */
203 DRAWING_Status UI_DRAWING_BVI_drawThickLine(MICROUI_GraphicsContext* gc, jint startX, jint startY, jint endX, jint endY, jint thickness);
204 
205 /*
206  * @brief Implementation of drawThickCircle over a BufferedVectorImage. See ui_drawing.h
207  */
208 DRAWING_Status UI_DRAWING_BVI_drawThickCircle(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jint thickness);
209 
210 /*
211  * @brief Implementation of drawThickEllipse over a BufferedVectorImage. See ui_drawing.h
212  */
213 DRAWING_Status UI_DRAWING_BVI_drawThickEllipse(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jint thickness);
214 
215 /*
216  * @brief Implementation of drawThickCircleArc over a BufferedVectorImage. See ui_drawing.h
217  */
218 DRAWING_Status UI_DRAWING_BVI_drawThickCircleArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jfloat startAngle, jfloat arcAngle, jint thickness);
219 
220 /*
221  * @brief Implementation of drawFlippedImage over a BufferedVectorImage. See ui_drawing.h
222  */
223 DRAWING_Status UI_DRAWING_BVI_drawFlippedImage(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint regionX, jint regionY, jint width, jint height, jint x, jint y, DRAWING_Flip transformation, jint alpha);
224 
225 /*
226  * @brief Implementation of drawRotatedImageNearestNeighbor over a BufferedVectorImage. See ui_drawing.h
227  */
228 DRAWING_Status UI_DRAWING_BVI_drawRotatedImageNearestNeighbor(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jint rotationX, jint rotationY, jfloat angle, jint alpha);
229 
230 /*
231  * @brief Implementation of drawRotatedImageBilinear over a BufferedVectorImage. See ui_drawing.h
232  */
233 DRAWING_Status UI_DRAWING_BVI_drawRotatedImageBilinear(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jint rotationX, jint rotationY, jfloat angle, jint alpha);
234 
235 /*
236  * @brief Implementation of drawScaledImageNearestNeighbor over a BufferedVectorImage. See ui_drawing.h
237  */
238 DRAWING_Status UI_DRAWING_BVI_drawScaledImageNearestNeighbor(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jfloat factorX, jfloat factorY, jint alpha);
239 
240 /*
241  * @brief Implementation of drawScaledImageBilinear over a BufferedVectorImage. See ui_drawing.h
242  */
243 DRAWING_Status UI_DRAWING_BVI_drawScaledImageBilinear(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jfloat factorX, jfloat factorY, jint alpha);
244 
245 // --------------------------------------------------------------------------------
246 // EOF
247 // --------------------------------------------------------------------------------
248 
249 #endif // #if defined VG_FEATURE_BUFFERED_VECTOR_IMAGE
250 
251 #ifdef __cplusplus
252 }
253 #endif
254 #endif // UI_DRAWING_BVI_H
MicroEJ MicroVG library low level API: enable some features according to the hardware capacities...