microvg  3.0.1
microvg
ui_drawing_bvi.h
1 /*
2  * Copyright 2023 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 3.0.1
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 
45 #define UI_DRAWING_BVI_drawLine CONCAT(UI_DRAWING_drawLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
46 #define UI_DRAWING_BVI_drawHorizontalLine CONCAT(UI_DRAWING_drawHorizontalLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
47 #define UI_DRAWING_BVI_drawVerticalLine CONCAT(UI_DRAWING_drawVerticalLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
48 #define UI_DRAWING_BVI_fillRectangle CONCAT(UI_DRAWING_fillRectangle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
49 #define UI_DRAWING_BVI_drawRoundedRectangle CONCAT(UI_DRAWING_drawRoundedRectangle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
50 #define UI_DRAWING_BVI_fillRoundedRectangle CONCAT(UI_DRAWING_fillRoundedRectangle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
51 #define UI_DRAWING_BVI_drawCircleArc CONCAT(UI_DRAWING_drawCircleArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
52 #define UI_DRAWING_BVI_drawEllipseArc CONCAT(UI_DRAWING_drawEllipseArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
53 #define UI_DRAWING_BVI_fillCircleArc CONCAT(UI_DRAWING_fillCircleArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
54 #define UI_DRAWING_BVI_fillEllipseArc CONCAT(UI_DRAWING_fillEllipseArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
55 #define UI_DRAWING_BVI_drawEllipse CONCAT(UI_DRAWING_drawEllipse_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
56 #define UI_DRAWING_BVI_fillEllipse CONCAT(UI_DRAWING_fillEllipse_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
57 #define UI_DRAWING_BVI_drawCircle CONCAT(UI_DRAWING_drawCircle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
58 #define UI_DRAWING_BVI_fillCircle CONCAT(UI_DRAWING_fillCircle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
59 #define UI_DRAWING_BVI_drawThickFadedPoint CONCAT(UI_DRAWING_drawThickFadedPoint_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
60 #define UI_DRAWING_BVI_drawThickFadedLine CONCAT(UI_DRAWING_drawThickFadedLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
61 #define UI_DRAWING_BVI_drawThickFadedCircle CONCAT(UI_DRAWING_drawThickFadedCircle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
62 #define UI_DRAWING_BVI_drawThickFadedCircleArc CONCAT(UI_DRAWING_drawThickFadedCircleArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
63 #define UI_DRAWING_BVI_drawThickFadedEllipse CONCAT(UI_DRAWING_drawThickFadedEllipse_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
64 #define UI_DRAWING_BVI_drawThickLine CONCAT(UI_DRAWING_drawThickLine_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
65 #define UI_DRAWING_BVI_drawThickCircle CONCAT(UI_DRAWING_drawThickCircle_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
66 #define UI_DRAWING_BVI_drawThickEllipse CONCAT(UI_DRAWING_drawThickEllipse_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
67 #define UI_DRAWING_BVI_drawThickCircleArc CONCAT(UI_DRAWING_drawThickCircleArc_, UI_DRAWING_IDENTIFIER_BVI_FORMAT)
68 
69 // --------------------------------------------------------------------------------
70 // ui_drawing.h API
71 // (the function names differ according to the available number of destination formats)
72 // --------------------------------------------------------------------------------
73 
74 /*
75  * @brief Implementation of adjustNewImageCharacteristics for a BufferedVectorImage. See ui_drawing.h
76  */
77 void UI_DRAWING_BVI_adjustNewImageCharacteristics(jbyte image_format, uint32_t width, uint32_t height, uint32_t* data_size, uint32_t* data_alignment);
78 
79 /*
80  * @brief Implementation of initializeNewImage for a BufferedVectorImage. See ui_drawing.h
81  */
82 void UI_DRAWING_BVI_initializeNewImage(MICROUI_Image* image);
83 
84 /*
85  * @brief Implementation of drawLine over a BufferedVectorImage. See ui_drawing.h
86  */
87 DRAWING_Status UI_DRAWING_BVI_drawLine(MICROUI_GraphicsContext* gc, jint startX, jint startY, jint endX, jint endY);
88 
89 /*
90  * @brief Implementation of drawHorizontalLine over a BufferedVectorImage. See ui_drawing.h
91  */
92 DRAWING_Status UI_DRAWING_BVI_drawHorizontalLine(MICROUI_GraphicsContext* gc, jint x1, jint x2, jint y);
93 
94 /*
95  * @brief Implementation of drawVerticalLine over a BufferedVectorImage. See ui_drawing.h
96  */
97 DRAWING_Status UI_DRAWING_BVI_drawVerticalLine(MICROUI_GraphicsContext* gc, jint x, jint y1, jint y2);
98 
99 /*
100  * @brief Implementation of fillRectangle over a BufferedVectorImage. See ui_drawing.h
101  */
102 DRAWING_Status UI_DRAWING_BVI_fillRectangle(MICROUI_GraphicsContext* gc, jint x1, jint y1, jint x2, jint y2);
103 
104 /*
105  * @brief Implementation of drawRoundedRectangle over a BufferedVectorImage. See ui_drawing.h
106  */
107 DRAWING_Status UI_DRAWING_BVI_drawRoundedRectangle(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jint cornerEllipseWidth, jint cornerEllipseHeight);
108 
109 /*
110  * @brief Implementation of fillRoundedRectangle over a BufferedVectorImage. See ui_drawing.h
111  */
112 DRAWING_Status UI_DRAWING_BVI_fillRoundedRectangle(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jint cornerEllipseWidth, jint cornerEllipseHeight);
113 
114 /*
115  * @brief Implementation of drawCircleArc over a BufferedVectorImage. See ui_drawing.h
116  */
117 DRAWING_Status UI_DRAWING_BVI_drawCircleArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jfloat startAngle, jfloat arcAngle);
118 
119 /*
120  * @brief Implementation of drawEllipseArc over a BufferedVectorImage. See ui_drawing.h
121  */
122 DRAWING_Status UI_DRAWING_BVI_drawEllipseArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jfloat startAngle, jfloat arcAngle);
123 
124 /*
125  * @brief Implementation of fillCircleArc over a BufferedVectorImage. See ui_drawing.h
126  */
127 DRAWING_Status UI_DRAWING_BVI_fillCircleArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jfloat startAngle, jfloat arcAngle);
128 
129 /*
130  * @brief Implementation of fillEllipseArc over a BufferedVectorImage. See ui_drawing.h
131  */
132 DRAWING_Status UI_DRAWING_BVI_fillEllipseArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jfloat startAngle, jfloat arcAngle);
133 
134 /*
135  * @brief Implementation of drawEllipse over a BufferedVectorImage. See ui_drawing.h
136  */
137 DRAWING_Status UI_DRAWING_BVI_drawEllipse(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height);
138 
139 /*
140  * @brief Implementation of fillEllipse over a BufferedVectorImage. See ui_drawing.h
141  */
142 DRAWING_Status UI_DRAWING_BVI_fillEllipse(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height);
143 
144 /*
145  * @brief Implementation of drawCircle over a BufferedVectorImage. See ui_drawing.h
146  */
147 DRAWING_Status UI_DRAWING_BVI_drawCircle(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter);
148 
149 /*
150  * @brief Implementation of fillCircle over a BufferedVectorImage. See ui_drawing.h
151  */
152 DRAWING_Status UI_DRAWING_BVI_fillCircle(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter);
153 
154 /*
155  * @brief Implementation of drawImage over a BufferedVectorImage. See ui_drawing.h
156  */
157 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);
158 
159 /*
160  * @brief Implementation of copyImage over a BufferedVectorImage. See ui_drawing.h
161  */
162 DRAWING_Status UI_DRAWING_BVI_copyImage(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint regionX, jint regionY, jint width, jint height, jint x, jint y);
163 
164 /*
165  * @brief Implementation of drawRegion over a BufferedVectorImage. See ui_drawing.h
166  */
167 DRAWING_Status UI_DRAWING_BVI_drawRegion(MICROUI_GraphicsContext* gc, jint regionX, jint regionY, jint width, jint height, jint x, jint y, jint alpha);
168 
169 /*
170  * @brief Implementation of drawThickFadedPoint over a BufferedVectorImage. See ui_drawing.h
171  */
172 DRAWING_Status UI_DRAWING_BVI_drawThickFadedPoint(MICROUI_GraphicsContext* gc, jint x, jint y, jint thickness, jint fade);
173 
174 /*
175  * @brief Implementation of drawThickFadedLine over a BufferedVectorImage. See ui_drawing.h
176  */
177 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);
178 
179 /*
180  * @brief Implementation of drawThickFadedCircle over a BufferedVectorImage. See ui_drawing.h
181  */
182 DRAWING_Status UI_DRAWING_BVI_drawThickFadedCircle(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jint thickness, jint fade);
183 
184 /*
185  * @brief Implementation of drawThickFadedCircleArc over a BufferedVectorImage. See ui_drawing.h
186  */
187 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);
188 
189 /*
190  * @brief Implementation of drawThickFadedEllipse over a BufferedVectorImage. See ui_drawing.h
191  */
192 DRAWING_Status UI_DRAWING_BVI_drawThickFadedEllipse(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jint thickness, jint fade);
193 
194 /*
195  * @brief Implementation of drawThickLine over a BufferedVectorImage. See ui_drawing.h
196  */
197 DRAWING_Status UI_DRAWING_BVI_drawThickLine(MICROUI_GraphicsContext* gc, jint startX, jint startY, jint endX, jint endY, jint thickness);
198 
199 /*
200  * @brief Implementation of drawThickCircle over a BufferedVectorImage. See ui_drawing.h
201  */
202 DRAWING_Status UI_DRAWING_BVI_drawThickCircle(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jint thickness);
203 
204 /*
205  * @brief Implementation of drawThickEllipse over a BufferedVectorImage. See ui_drawing.h
206  */
207 DRAWING_Status UI_DRAWING_BVI_drawThickEllipse(MICROUI_GraphicsContext* gc, jint x, jint y, jint width, jint height, jint thickness);
208 
209 /*
210  * @brief Implementation of drawThickCircleArc over a BufferedVectorImage. See ui_drawing.h
211  */
212 DRAWING_Status UI_DRAWING_BVI_drawThickCircleArc(MICROUI_GraphicsContext* gc, jint x, jint y, jint diameter, jfloat startAngle, jfloat arcAngle, jint thickness);
213 
214 /*
215  * @brief Implementation of drawFlippedImage over a BufferedVectorImage. See ui_drawing.h
216  */
217 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);
218 
219 /*
220  * @brief Implementation of drawRotatedImageNearestNeighbor over a BufferedVectorImage. See ui_drawing.h
221  */
222 DRAWING_Status UI_DRAWING_BVI_drawRotatedImageNearestNeighbor(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jint rotationX, jint rotationY, jfloat angle, jint alpha);
223 
224 /*
225  * @brief Implementation of drawRotatedImageBilinear over a BufferedVectorImage. See ui_drawing.h
226  */
227 DRAWING_Status UI_DRAWING_BVI_drawRotatedImageBilinear(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jint rotationX, jint rotationY, jfloat angle, jint alpha);
228 
229 /*
230  * @brief Implementation of drawScaledImageNearestNeighbor over a BufferedVectorImage. See ui_drawing.h
231  */
232 DRAWING_Status UI_DRAWING_BVI_drawScaledImageNearestNeighbor(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jfloat factorX, jfloat factorY, jint alpha);
233 
234 /*
235  * @brief Implementation of drawScaledImageBilinear over a BufferedVectorImage. See ui_drawing.h
236  */
237 DRAWING_Status UI_DRAWING_BVI_drawScaledImageBilinear(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jfloat factorX, jfloat factorY, jint alpha);
238 
239 // --------------------------------------------------------------------------------
240 // EOF
241 // --------------------------------------------------------------------------------
242 
243 #endif // #if defined VG_FEATURE_BUFFERED_VECTOR_IMAGE
244 
245 #ifdef __cplusplus
246 }
247 #endif
248 #endif // UI_DRAWING_BVI_H
MicroEJ MicroVG library low level API: enable some features according to the hardware capacities...