microui  14.1.0
microui
ui_image_drawing.c
1 /*
2  * C
3  *
4  * Copyright 2023-2024 MicroEJ Corp. All rights reserved.
5  * Use of this source code is governed by a BSD-style license that can be found with this software.
6  */
7 
8 /*
9  * @file
10  * @brief Implementation of all drawing functions of ui_image_drawing.h.
11  * @author MicroEJ Developer Team
12  * @version 14.1.0
13  * @see ui_image_drawing.h
14  */
15 
16 // --------------------------------------------------------------------------------
17 // Includes
18 // --------------------------------------------------------------------------------
19 
20 #include <LLUI_DISPLAY.h>
21 
22 #include "ui_image_drawing.h"
23 #include "ui_drawing_soft.h"
24 #include "dw_drawing_soft.h"
25 #include "ui_drawing_stub.h"
26 #include "ui_configuration.h"
27 #include "bsp_util.h"
28 
29 #if defined(UI_FEATURE_IMAGE_CUSTOM_FORMATS)
30 
31 /*
32  * VEE Port supports several images formats: standard (ARGB8888, A8, etc) and one or
33  * several custom formats. The next functions and tables redirect the image drawing
34  * to the right image manager (stub, soft or custom).
35  *
36  * VEE Port may support several destination formats: display format, one or several
37  * standard formats and one or several custom formats. See _get_table_index().
38  *
39  * Note: The functions are called by ui_drawing.c. The use of GPU should be checked
40  * in ui_drawing.c and not here.
41  */
42 
43 // --------------------------------------------------------------------------------
44 // Defines
45 // --------------------------------------------------------------------------------
46 
47 /*
48  * @brief Indices in the tables UI_IMAGE_DRAWING_xxx_custom[]
49  */
50 #define TABLE_INDEX_STUB 0 // index to call functions stub
51 #define TABLE_INDEX_SOFT 1 // index to call functions in software
52 #define TABLE_INDEX_CUSTOM_OFFSET 2 // index to call VEE Port functions
53 
54 #define GET_CUSTOM_IMAGE_INDEX(img) (((uint8_t)TABLE_INDEX_CUSTOM_OFFSET) + ((uint8_t)MICROUI_IMAGE_FORMAT_CUSTOM_0) - \
55  ((uint8_t)((img)->format)))
56 
57 // --------------------------------------------------------------------------------
58 // Extern functions
59 // --------------------------------------------------------------------------------
60 
61 /*
62  * @brief Set of drawing functions according to the source image format.
63  *
64  * These functions must be declared in other H files.
65  */
66 
67 extern DRAWING_Status UI_IMAGE_DRAWING_draw_custom0(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
68  jint regionY, jint width, jint height, jint x, jint y, jint alpha);
69 extern DRAWING_Status UI_IMAGE_DRAWING_draw_custom1(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
70  jint regionY, jint width, jint height, jint x, jint y, jint alpha);
71 extern DRAWING_Status UI_IMAGE_DRAWING_draw_custom2(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
72  jint regionY, jint width, jint height, jint x, jint y, jint alpha);
73 extern DRAWING_Status UI_IMAGE_DRAWING_draw_custom3(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
74  jint regionY, jint width, jint height, jint x, jint y, jint alpha);
75 extern DRAWING_Status UI_IMAGE_DRAWING_draw_custom4(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
76  jint regionY, jint width, jint height, jint x, jint y, jint alpha);
77 extern DRAWING_Status UI_IMAGE_DRAWING_draw_custom5(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
78  jint regionY, jint width, jint height, jint x, jint y, jint alpha);
79 extern DRAWING_Status UI_IMAGE_DRAWING_draw_custom6(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
80  jint regionY, jint width, jint height, jint x, jint y, jint alpha);
81 extern DRAWING_Status UI_IMAGE_DRAWING_draw_custom7(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
82  jint regionY, jint width, jint height, jint x, jint y, jint alpha);
83 
84 extern DRAWING_Status UI_IMAGE_DRAWING_copy_custom0(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
85  jint regionY, jint width, jint height, jint x, jint y);
86 extern DRAWING_Status UI_IMAGE_DRAWING_copy_custom1(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
87  jint regionY, jint width, jint height, jint x, jint y);
88 extern DRAWING_Status UI_IMAGE_DRAWING_copy_custom2(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
89  jint regionY, jint width, jint height, jint x, jint y);
90 extern DRAWING_Status UI_IMAGE_DRAWING_copy_custom3(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
91  jint regionY, jint width, jint height, jint x, jint y);
92 extern DRAWING_Status UI_IMAGE_DRAWING_copy_custom4(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
93  jint regionY, jint width, jint height, jint x, jint y);
94 extern DRAWING_Status UI_IMAGE_DRAWING_copy_custom5(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
95  jint regionY, jint width, jint height, jint x, jint y);
96 extern DRAWING_Status UI_IMAGE_DRAWING_copy_custom6(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
97  jint regionY, jint width, jint height, jint x, jint y);
98 extern DRAWING_Status UI_IMAGE_DRAWING_copy_custom7(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
99  jint regionY, jint width, jint height, jint x, jint y);
100 
101 extern DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom0(MICROUI_GraphicsContext *gc, jint regionX, jint regionY,
102  jint width, jint height, jint x, jint y, jint alpha);
103 extern DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom1(MICROUI_GraphicsContext *gc, jint regionX, jint regionY,
104  jint width, jint height, jint x, jint y, jint alpha);
105 extern DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom2(MICROUI_GraphicsContext *gc, jint regionX, jint regionY,
106  jint width, jint height, jint x, jint y, jint alpha);
107 extern DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom3(MICROUI_GraphicsContext *gc, jint regionX, jint regionY,
108  jint width, jint height, jint x, jint y, jint alpha);
109 extern DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom4(MICROUI_GraphicsContext *gc, jint regionX, jint regionY,
110  jint width, jint height, jint x, jint y, jint alpha);
111 extern DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom5(MICROUI_GraphicsContext *gc, jint regionX, jint regionY,
112  jint width, jint height, jint x, jint y, jint alpha);
113 extern DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom6(MICROUI_GraphicsContext *gc, jint regionX, jint regionY,
114  jint width, jint height, jint x, jint y, jint alpha);
115 extern DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom7(MICROUI_GraphicsContext *gc, jint regionX, jint regionY,
116  jint width, jint height, jint x, jint y, jint alpha);
117 
118 extern DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom0(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
119  jint regionX, jint regionY, jint width, jint height, jint x,
120  jint y, DRAWING_Flip transformation, jint alpha);
121 extern DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom1(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
122  jint regionX, jint regionY, jint width, jint height, jint x,
123  jint y, DRAWING_Flip transformation, jint alpha);
124 extern DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom2(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
125  jint regionX, jint regionY, jint width, jint height, jint x,
126  jint y, DRAWING_Flip transformation, jint alpha);
127 extern DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom3(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
128  jint regionX, jint regionY, jint width, jint height, jint x,
129  jint y, DRAWING_Flip transformation, jint alpha);
130 extern DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom4(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
131  jint regionX, jint regionY, jint width, jint height, jint x,
132  jint y, DRAWING_Flip transformation, jint alpha);
133 extern DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom5(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
134  jint regionX, jint regionY, jint width, jint height, jint x,
135  jint y, DRAWING_Flip transformation, jint alpha);
136 extern DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom6(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
137  jint regionX, jint regionY, jint width, jint height, jint x,
138  jint y, DRAWING_Flip transformation, jint alpha);
139 extern DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom7(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
140  jint regionX, jint regionY, jint width, jint height, jint x,
141  jint y, DRAWING_Flip transformation, jint alpha);
142 
143 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom0(MICROUI_GraphicsContext *gc,
144  MICROUI_Image *img, jint x, jint y,
145  jint rotationX, jint rotationY, jfloat angle,
146  jint alpha);
147 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom1(MICROUI_GraphicsContext *gc,
148  MICROUI_Image *img, jint x, jint y,
149  jint rotationX, jint rotationY, jfloat angle,
150  jint alpha);
151 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom2(MICROUI_GraphicsContext *gc,
152  MICROUI_Image *img, jint x, jint y,
153  jint rotationX, jint rotationY, jfloat angle,
154  jint alpha);
155 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom3(MICROUI_GraphicsContext *gc,
156  MICROUI_Image *img, jint x, jint y,
157  jint rotationX, jint rotationY, jfloat angle,
158  jint alpha);
159 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom4(MICROUI_GraphicsContext *gc,
160  MICROUI_Image *img, jint x, jint y,
161  jint rotationX, jint rotationY, jfloat angle,
162  jint alpha);
163 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom5(MICROUI_GraphicsContext *gc,
164  MICROUI_Image *img, jint x, jint y,
165  jint rotationX, jint rotationY, jfloat angle,
166  jint alpha);
167 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom6(MICROUI_GraphicsContext *gc,
168  MICROUI_Image *img, jint x, jint y,
169  jint rotationX, jint rotationY, jfloat angle,
170  jint alpha);
171 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom7(MICROUI_GraphicsContext *gc,
172  MICROUI_Image *img, jint x, jint y,
173  jint rotationX, jint rotationY, jfloat angle,
174  jint alpha);
175 
176 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom0(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
177  jint x, jint y, jint rotationX, jint rotationY,
178  jfloat angle, jint alpha);
179 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom1(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
180  jint x, jint y, jint rotationX, jint rotationY,
181  jfloat angle, jint alpha);
182 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom2(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
183  jint x, jint y, jint rotationX, jint rotationY,
184  jfloat angle, jint alpha);
185 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom3(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
186  jint x, jint y, jint rotationX, jint rotationY,
187  jfloat angle, jint alpha);
188 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom4(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
189  jint x, jint y, jint rotationX, jint rotationY,
190  jfloat angle, jint alpha);
191 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom5(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
192  jint x, jint y, jint rotationX, jint rotationY,
193  jfloat angle, jint alpha);
194 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom6(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
195  jint x, jint y, jint rotationX, jint rotationY,
196  jfloat angle, jint alpha);
197 extern DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom7(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
198  jint x, jint y, jint rotationX, jint rotationY,
199  jfloat angle, jint alpha);
200 
201 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom0(MICROUI_GraphicsContext *gc,
202  MICROUI_Image *img, jint x, jint y,
203  jfloat factorX, jfloat factorY, jint alpha);
204 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom1(MICROUI_GraphicsContext *gc,
205  MICROUI_Image *img, jint x, jint y,
206  jfloat factorX, jfloat factorY, jint alpha);
207 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom2(MICROUI_GraphicsContext *gc,
208  MICROUI_Image *img, jint x, jint y,
209  jfloat factorX, jfloat factorY, jint alpha);
210 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom3(MICROUI_GraphicsContext *gc,
211  MICROUI_Image *img, jint x, jint y,
212  jfloat factorX, jfloat factorY, jint alpha);
213 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom4(MICROUI_GraphicsContext *gc,
214  MICROUI_Image *img, jint x, jint y,
215  jfloat factorX, jfloat factorY, jint alpha);
216 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom5(MICROUI_GraphicsContext *gc,
217  MICROUI_Image *img, jint x, jint y,
218  jfloat factorX, jfloat factorY, jint alpha);
219 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom6(MICROUI_GraphicsContext *gc,
220  MICROUI_Image *img, jint x, jint y,
221  jfloat factorX, jfloat factorY, jint alpha);
222 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom7(MICROUI_GraphicsContext *gc,
223  MICROUI_Image *img, jint x, jint y,
224  jfloat factorX, jfloat factorY, jint alpha);
225 
226 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom0(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
227  jint x, jint y, jfloat factorX, jfloat factorY,
228  jint alpha);
229 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom1(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
230  jint x, jint y, jfloat factorX, jfloat factorY,
231  jint alpha);
232 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom2(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
233  jint x, jint y, jfloat factorX, jfloat factorY,
234  jint alpha);
235 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom3(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
236  jint x, jint y, jfloat factorX, jfloat factorY,
237  jint alpha);
238 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom4(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
239  jint x, jint y, jfloat factorX, jfloat factorY,
240  jint alpha);
241 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom5(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
242  jint x, jint y, jfloat factorX, jfloat factorY,
243  jint alpha);
244 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom6(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
245  jint x, jint y, jfloat factorX, jfloat factorY,
246  jint alpha);
247 extern DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom7(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
248  jint x, jint y, jfloat factorX, jfloat factorY,
249  jint alpha);
250 
251 // --------------------------------------------------------------------------------
252 // Typedef of drawing functions
253 // --------------------------------------------------------------------------------
254 
255 typedef DRAWING_Status (* UI_IMAGE_DRAWING_draw_t) (MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
256  jint regionY, jint width, jint height, jint x, jint y, jint alpha);
257 typedef DRAWING_Status (* UI_IMAGE_DRAWING_copy_t) (MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX,
258  jint regionY, jint width, jint height, jint x, jint y);
259 typedef DRAWING_Status (* UI_IMAGE_DRAWING_drawRegion_t) (MICROUI_GraphicsContext *gc, jint regionX, jint regionY,
260  jint width, jint height, jint x, jint y, jint alpha);
261 typedef DRAWING_Status (* UI_IMAGE_DRAWING_drawFlipped_t) (MICROUI_GraphicsContext *gc, MICROUI_Image *img,
262  jint regionX, jint regionY, jint width, jint height, jint x,
263  jint y, DRAWING_Flip transformation, jint alpha);
264 typedef DRAWING_Status (* UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_t) (MICROUI_GraphicsContext *gc,
265  MICROUI_Image *img, jint x, jint y,
266  jint rotationX, jint rotationY, jfloat angle,
267  jint alpha);
268 typedef DRAWING_Status (* UI_IMAGE_DRAWING_drawRotatedBilinear_t) (MICROUI_GraphicsContext *gc, MICROUI_Image *img,
269  jint x, jint y, jint rotationX, jint rotationY,
270  jfloat angle, jint alpha);
271 typedef DRAWING_Status (* UI_IMAGE_DRAWING_drawScaledNearestNeighbor_t) (MICROUI_GraphicsContext *gc,
272  MICROUI_Image *img, jint x, jint y,
273  jfloat factorX, jfloat factorY, jint alpha);
274 typedef DRAWING_Status (* UI_IMAGE_DRAWING_drawScaledBilinear_t) (MICROUI_GraphicsContext *gc, MICROUI_Image *img,
275  jint x, jint y, jfloat factorX, jfloat factorY,
276  jint alpha);
277 
278 // --------------------------------------------------------------------------------
279 // Tables according to the source image format.
280 // --------------------------------------------------------------------------------
281 
282 static const UI_IMAGE_DRAWING_draw_t UI_IMAGE_DRAWING_draw_custom[] = {
283  &UI_DRAWING_STUB_drawImage,
284  &UI_DRAWING_SOFT_drawImage,
285  &UI_IMAGE_DRAWING_draw_custom0,
286  &UI_IMAGE_DRAWING_draw_custom1,
287  &UI_IMAGE_DRAWING_draw_custom2,
288  &UI_IMAGE_DRAWING_draw_custom3,
289  &UI_IMAGE_DRAWING_draw_custom4,
290  &UI_IMAGE_DRAWING_draw_custom5,
291  &UI_IMAGE_DRAWING_draw_custom6,
292  &UI_IMAGE_DRAWING_draw_custom7,
293 };
294 
295 static const UI_IMAGE_DRAWING_copy_t UI_IMAGE_DRAWING_copy_custom[] = {
296  UI_DRAWING_STUB_copyImage,
297  UI_DRAWING_SOFT_copyImage,
298  &UI_IMAGE_DRAWING_copy_custom0,
299  &UI_IMAGE_DRAWING_copy_custom1,
300  &UI_IMAGE_DRAWING_copy_custom2,
301  &UI_IMAGE_DRAWING_copy_custom3,
302  &UI_IMAGE_DRAWING_copy_custom4,
303  &UI_IMAGE_DRAWING_copy_custom5,
304  &UI_IMAGE_DRAWING_copy_custom6,
305  &UI_IMAGE_DRAWING_copy_custom7,
306 };
307 
308 static const UI_IMAGE_DRAWING_drawRegion_t UI_IMAGE_DRAWING_drawRegion_custom[] = {
309  UI_DRAWING_STUB_drawRegion,
310  UI_DRAWING_SOFT_drawRegion,
311  &UI_IMAGE_DRAWING_drawRegion_custom0,
312  &UI_IMAGE_DRAWING_drawRegion_custom1,
313  &UI_IMAGE_DRAWING_drawRegion_custom2,
314  &UI_IMAGE_DRAWING_drawRegion_custom3,
315  &UI_IMAGE_DRAWING_drawRegion_custom4,
316  &UI_IMAGE_DRAWING_drawRegion_custom5,
317  &UI_IMAGE_DRAWING_drawRegion_custom6,
318  &UI_IMAGE_DRAWING_drawRegion_custom7,
319 };
320 
321 static const UI_IMAGE_DRAWING_drawFlipped_t UI_IMAGE_DRAWING_drawFlipped_custom[] = {
322  UI_DRAWING_STUB_drawFlippedImage,
323  DW_DRAWING_SOFT_drawFlippedImage,
324  &UI_IMAGE_DRAWING_drawFlipped_custom0,
325  &UI_IMAGE_DRAWING_drawFlipped_custom1,
326  &UI_IMAGE_DRAWING_drawFlipped_custom2,
327  &UI_IMAGE_DRAWING_drawFlipped_custom3,
328  &UI_IMAGE_DRAWING_drawFlipped_custom4,
329  &UI_IMAGE_DRAWING_drawFlipped_custom5,
330  &UI_IMAGE_DRAWING_drawFlipped_custom6,
331  &UI_IMAGE_DRAWING_drawFlipped_custom7,
332 };
333 
334 static const UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_t UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom[] = {
335  UI_DRAWING_STUB_drawRotatedImageNearestNeighbor,
336  DW_DRAWING_SOFT_drawRotatedImageNearestNeighbor,
337  &UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom0,
338  &UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom1,
339  &UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom2,
340  &UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom3,
341  &UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom4,
342  &UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom5,
343  &UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom6,
344  &UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom7,
345 };
346 
347 static const UI_IMAGE_DRAWING_drawRotatedBilinear_t UI_IMAGE_DRAWING_drawRotatedBilinear_custom[] = {
348  UI_DRAWING_STUB_drawRotatedImageBilinear,
349  DW_DRAWING_SOFT_drawRotatedImageBilinear,
350  &UI_IMAGE_DRAWING_drawRotatedBilinear_custom0,
351  &UI_IMAGE_DRAWING_drawRotatedBilinear_custom1,
352  &UI_IMAGE_DRAWING_drawRotatedBilinear_custom2,
353  &UI_IMAGE_DRAWING_drawRotatedBilinear_custom3,
354  &UI_IMAGE_DRAWING_drawRotatedBilinear_custom4,
355  &UI_IMAGE_DRAWING_drawRotatedBilinear_custom5,
356  &UI_IMAGE_DRAWING_drawRotatedBilinear_custom6,
357  &UI_IMAGE_DRAWING_drawRotatedBilinear_custom7,
358 };
359 
360 static const UI_IMAGE_DRAWING_drawScaledNearestNeighbor_t UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom[] = {
361  UI_DRAWING_STUB_drawScaledImageNearestNeighbor,
362  DW_DRAWING_SOFT_drawScaledImageNearestNeighbor,
363  &UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom0,
364  &UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom1,
365  &UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom2,
366  &UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom3,
367  &UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom4,
368  &UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom5,
369  &UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom6,
370  &UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom7,
371 };
372 
373 static const UI_IMAGE_DRAWING_drawScaledBilinear_t UI_IMAGE_DRAWING_drawScaledBilinear_custom[] = {
374  UI_DRAWING_STUB_drawScaledImageBilinear,
375  DW_DRAWING_SOFT_drawScaledImageBilinear,
376  &UI_IMAGE_DRAWING_drawScaledBilinear_custom0,
377  &UI_IMAGE_DRAWING_drawScaledBilinear_custom1,
378  &UI_IMAGE_DRAWING_drawScaledBilinear_custom2,
379  &UI_IMAGE_DRAWING_drawScaledBilinear_custom3,
380  &UI_IMAGE_DRAWING_drawScaledBilinear_custom4,
381  &UI_IMAGE_DRAWING_drawScaledBilinear_custom5,
382  &UI_IMAGE_DRAWING_drawScaledBilinear_custom6,
383  &UI_IMAGE_DRAWING_drawScaledBilinear_custom7,
384 };
385 
386 // --------------------------------------------------------------------------------
387 // Private functions
388 // --------------------------------------------------------------------------------
389 
390 static inline uint32_t _get_table_index(MICROUI_GraphicsContext *gc, MICROUI_Image *img) {
391  uint32_t index;
392  if (!LLUI_DISPLAY_isCustomFormat(img->format)) {
393 #if !defined(UI_GC_SUPPORTED_FORMATS) || (UI_GC_SUPPORTED_FORMATS <= 1)
394  (void)gc;
395  // standard image in display GC -> can use soft algo
396  index = TABLE_INDEX_SOFT;
397 #else
398  index = LLUI_DISPLAY_isDisplayFormat(gc->image.format) ? TABLE_INDEX_SOFT : TABLE_INDEX_STUB;
399 #endif
400  } else {
401  // use the specific image manager to draw the custom image
402  // (this manager must check the destination format)
403  // cppcheck-suppress [misra-c2012-10.6] convert image format to an index
404  index = GET_CUSTOM_IMAGE_INDEX(img);
405  }
406  return index;
407 }
408 
409 // --------------------------------------------------------------------------------
410 // ui_image_drawing.h functions
411 // --------------------------------------------------------------------------------
412 
413 // See the header file for the function documentation
414 DRAWING_Status UI_IMAGE_DRAWING_draw(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
415  jint width, jint height, jint x, jint y, jint alpha) {
416  return (*UI_IMAGE_DRAWING_draw_custom[_get_table_index(gc, img)])(gc, img, regionX, regionY, width, height, x, y,
417  alpha);
418 }
419 
420 // See the header file for the function documentation
421 DRAWING_Status UI_IMAGE_DRAWING_copy(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
422  jint width, jint height, jint x, jint y) {
423  return (*UI_IMAGE_DRAWING_copy_custom[_get_table_index(gc, img)])(gc, img, regionX, regionY, width, height, x, y);
424 }
425 
426 // See the header file for the function documentation
427 DRAWING_Status UI_IMAGE_DRAWING_drawRegion(MICROUI_GraphicsContext *gc, jint regionX, jint regionY, jint width,
428  jint height, jint x, jint y, jint alpha) {
429  return (*UI_IMAGE_DRAWING_drawRegion_custom[_get_table_index(gc, &gc->image)])(gc, regionX, regionY, width, height,
430  x, y, alpha);
431 }
432 
433 // See the header file for the function documentation
434 DRAWING_Status UI_IMAGE_DRAWING_drawFlipped(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
435  jint width, jint height, jint x, jint y, DRAWING_Flip transformation,
436  jint alpha) {
437  return (*UI_IMAGE_DRAWING_drawFlipped_custom[_get_table_index(gc, img)])(gc, img, regionX, regionY, width, height,
438  x, y, transformation, alpha);
439 }
440 
441 // See the header file for the function documentation
442 DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x,
443  jint y, jint rotationX, jint rotationY, jfloat angle,
444  jint alpha) {
445  return (*UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom[_get_table_index(gc, img)])(gc, img, x, y, rotationX,
446  rotationY, angle, alpha);
447 }
448 
449 // See the header file for the function documentation
450 DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
451  jint rotationX, jint rotationY, jfloat angle, jint alpha) {
452  return (*UI_IMAGE_DRAWING_drawRotatedBilinear_custom[_get_table_index(gc, img)])(gc, img, x, y, rotationX,
453  rotationY, angle, alpha);
454 }
455 
456 // See the header file for the function documentation
457 DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x,
458  jint y, jfloat factorX, jfloat factorY, jint alpha) {
459  return (*UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom[_get_table_index(gc, img)])(gc, img, x, y, factorX,
460  factorY, alpha);
461 }
462 
463 // See the header file for the function documentation
464 DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
465  jfloat factorX, jfloat factorY, jint alpha) {
466  return (*UI_IMAGE_DRAWING_drawScaledBilinear_custom[_get_table_index(gc, img)])(gc, img, x, y, factorX, factorY,
467  alpha);
468 }
469 
470 // --------------------------------------------------------------------------------
471 // Table weak functions
472 // --------------------------------------------------------------------------------
473 
474 // See the header file for the function documentation
475 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_draw_custom0(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
476  jint regionX, jint regionY, jint width, jint height,
477  jint x, jint y, jint alpha) {
478  return UI_DRAWING_STUB_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha);
479 }
480 
481 // See the header file for the function documentation
482 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_draw_custom1(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
483  jint regionX, jint regionY, jint width, jint height,
484  jint x, jint y, jint alpha) {
485  return UI_DRAWING_STUB_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha);
486 }
487 
488 // See the header file for the function documentation
489 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_draw_custom2(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
490  jint regionX, jint regionY, jint width, jint height,
491  jint x, jint y, jint alpha) {
492  return UI_DRAWING_STUB_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha);
493 }
494 
495 // See the header file for the function documentation
496 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_draw_custom3(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
497  jint regionX, jint regionY, jint width, jint height,
498  jint x, jint y, jint alpha) {
499  return UI_DRAWING_STUB_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha);
500 }
501 
502 // See the header file for the function documentation
503 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_draw_custom4(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
504  jint regionX, jint regionY, jint width, jint height,
505  jint x, jint y, jint alpha) {
506  return UI_DRAWING_STUB_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha);
507 }
508 
509 // See the header file for the function documentation
510 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_draw_custom5(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
511  jint regionX, jint regionY, jint width, jint height,
512  jint x, jint y, jint alpha) {
513  return UI_DRAWING_STUB_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha);
514 }
515 
516 // See the header file for the function documentation
517 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_draw_custom6(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
518  jint regionX, jint regionY, jint width, jint height,
519  jint x, jint y, jint alpha) {
520  return UI_DRAWING_STUB_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha);
521 }
522 
523 // See the header file for the function documentation
524 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_draw_custom7(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
525  jint regionX, jint regionY, jint width, jint height,
526  jint x, jint y, jint alpha) {
527  return UI_DRAWING_STUB_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha);
528 }
529 
530 // See the header file for the function documentation
531 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_copy_custom0(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
532  jint regionX, jint regionY, jint width, jint height,
533  jint x, jint y) {
534  return UI_DRAWING_STUB_copyImage(gc, img, regionX, regionY, width, height, x, y);
535 }
536 
537 // See the header file for the function documentation
538 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_copy_custom1(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
539  jint regionX, jint regionY, jint width, jint height,
540  jint x, jint y) {
541  return UI_DRAWING_STUB_copyImage(gc, img, regionX, regionY, width, height, x, y);
542 }
543 
544 // See the header file for the function documentation
545 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_copy_custom2(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
546  jint regionX, jint regionY, jint width, jint height,
547  jint x, jint y) {
548  return UI_DRAWING_STUB_copyImage(gc, img, regionX, regionY, width, height, x, y);
549 }
550 
551 // See the header file for the function documentation
552 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_copy_custom3(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
553  jint regionX, jint regionY, jint width, jint height,
554  jint x, jint y) {
555  return UI_DRAWING_STUB_copyImage(gc, img, regionX, regionY, width, height, x, y);
556 }
557 
558 // See the header file for the function documentation
559 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_copy_custom4(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
560  jint regionX, jint regionY, jint width, jint height,
561  jint x, jint y) {
562  return UI_DRAWING_STUB_copyImage(gc, img, regionX, regionY, width, height, x, y);
563 }
564 
565 // See the header file for the function documentation
566 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_copy_custom5(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
567  jint regionX, jint regionY, jint width, jint height,
568  jint x, jint y) {
569  return UI_DRAWING_STUB_copyImage(gc, img, regionX, regionY, width, height, x, y);
570 }
571 
572 // See the header file for the function documentation
573 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_copy_custom6(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
574  jint regionX, jint regionY, jint width, jint height,
575  jint x, jint y) {
576  return UI_DRAWING_STUB_copyImage(gc, img, regionX, regionY, width, height, x, y);
577 }
578 
579 // See the header file for the function documentation
580 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_copy_custom7(MICROUI_GraphicsContext *gc, MICROUI_Image *img,
581  jint regionX, jint regionY, jint width, jint height,
582  jint x, jint y) {
583  return UI_DRAWING_STUB_copyImage(gc, img, regionX, regionY, width, height, x, y);
584 }
585 
586 // See the header file for the function documentation
587 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom0(MICROUI_GraphicsContext *gc, jint regionX,
588  jint regionY, jint width, jint height, jint x,
589  jint y, jint alpha) {
590  return UI_DRAWING_STUB_drawRegion(gc, regionX, regionY, width, height, x, y, alpha);
591 }
592 
593 // See the header file for the function documentation
594 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom1(MICROUI_GraphicsContext *gc, jint regionX,
595  jint regionY, jint width, jint height, jint x,
596  jint y, jint alpha) {
597  return UI_DRAWING_STUB_drawRegion(gc, regionX, regionY, width, height, x, y, alpha);
598 }
599 
600 // See the header file for the function documentation
601 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom2(MICROUI_GraphicsContext *gc, jint regionX,
602  jint regionY, jint width, jint height, jint x,
603  jint y, jint alpha) {
604  return UI_DRAWING_STUB_drawRegion(gc, regionX, regionY, width, height, x, y, alpha);
605 }
606 
607 // See the header file for the function documentation
608 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom3(MICROUI_GraphicsContext *gc, jint regionX,
609  jint regionY, jint width, jint height, jint x,
610  jint y, jint alpha) {
611  return UI_DRAWING_STUB_drawRegion(gc, regionX, regionY, width, height, x, y, alpha);
612 }
613 
614 // See the header file for the function documentation
615 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom4(MICROUI_GraphicsContext *gc, jint regionX,
616  jint regionY, jint width, jint height, jint x,
617  jint y, jint alpha) {
618  return UI_DRAWING_STUB_drawRegion(gc, regionX, regionY, width, height, x, y, alpha);
619 }
620 
621 // See the header file for the function documentation
622 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom5(MICROUI_GraphicsContext *gc, jint regionX,
623  jint regionY, jint width, jint height, jint x,
624  jint y, jint alpha) {
625  return UI_DRAWING_STUB_drawRegion(gc, regionX, regionY, width, height, x, y, alpha);
626 }
627 
628 // See the header file for the function documentation
629 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom6(MICROUI_GraphicsContext *gc, jint regionX,
630  jint regionY, jint width, jint height, jint x,
631  jint y, jint alpha) {
632  return UI_DRAWING_STUB_drawRegion(gc, regionX, regionY, width, height, x, y, alpha);
633 }
634 
635 // See the header file for the function documentation
636 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRegion_custom7(MICROUI_GraphicsContext *gc, jint regionX,
637  jint regionY, jint width, jint height, jint x,
638  jint y, jint alpha) {
639  return UI_DRAWING_STUB_drawRegion(gc, regionX, regionY, width, height, x, y, alpha);
640 }
641 
642 // See the header file for the function documentation
643 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom0(MICROUI_GraphicsContext *gc,
644  MICROUI_Image *img, jint regionX,
645  jint regionY, jint width, jint height, jint x,
646  jint y, DRAWING_Flip transformation,
647  jint alpha) {
648  return UI_DRAWING_STUB_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha);
649 }
650 
651 // See the header file for the function documentation
652 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom1(MICROUI_GraphicsContext *gc,
653  MICROUI_Image *img, jint regionX,
654  jint regionY, jint width, jint height, jint x,
655  jint y, DRAWING_Flip transformation,
656  jint alpha) {
657  return UI_DRAWING_STUB_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha);
658 }
659 
660 // See the header file for the function documentation
661 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom2(MICROUI_GraphicsContext *gc,
662  MICROUI_Image *img, jint regionX,
663  jint regionY, jint width, jint height, jint x,
664  jint y, DRAWING_Flip transformation,
665  jint alpha) {
666  return UI_DRAWING_STUB_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha);
667 }
668 
669 // See the header file for the function documentation
670 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom3(MICROUI_GraphicsContext *gc,
671  MICROUI_Image *img, jint regionX,
672  jint regionY, jint width, jint height, jint x,
673  jint y, DRAWING_Flip transformation,
674  jint alpha) {
675  return UI_DRAWING_STUB_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha);
676 }
677 
678 // See the header file for the function documentation
679 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom4(MICROUI_GraphicsContext *gc,
680  MICROUI_Image *img, jint regionX,
681  jint regionY, jint width, jint height, jint x,
682  jint y, DRAWING_Flip transformation,
683  jint alpha) {
684  return UI_DRAWING_STUB_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha);
685 }
686 
687 // See the header file for the function documentation
688 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom5(MICROUI_GraphicsContext *gc,
689  MICROUI_Image *img, jint regionX,
690  jint regionY, jint width, jint height, jint x,
691  jint y, DRAWING_Flip transformation,
692  jint alpha) {
693  return UI_DRAWING_STUB_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha);
694 }
695 
696 // See the header file for the function documentation
697 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom6(MICROUI_GraphicsContext *gc,
698  MICROUI_Image *img, jint regionX,
699  jint regionY, jint width, jint height, jint x,
700  jint y, DRAWING_Flip transformation,
701  jint alpha) {
702  return UI_DRAWING_STUB_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha);
703 }
704 
705 // See the header file for the function documentation
706 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawFlipped_custom7(MICROUI_GraphicsContext *gc,
707  MICROUI_Image *img, jint regionX,
708  jint regionY, jint width, jint height, jint x,
709  jint y, DRAWING_Flip transformation,
710  jint alpha) {
711  return UI_DRAWING_STUB_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha);
712 }
713 
714 // See the header file for the function documentation
715 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom0(MICROUI_GraphicsContext *gc,
716  MICROUI_Image *img, jint x,
717  jint y, jint rotationX,
718  jint rotationY, jfloat angle,
719  jint alpha) {
720  return UI_DRAWING_STUB_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha);
721 }
722 
723 // See the header file for the function documentation
724 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom1(MICROUI_GraphicsContext *gc,
725  MICROUI_Image *img, jint x,
726  jint y, jint rotationX,
727  jint rotationY, jfloat angle,
728  jint alpha) {
729  return UI_DRAWING_STUB_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha);
730 }
731 
732 // See the header file for the function documentation
733 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom2(MICROUI_GraphicsContext *gc,
734  MICROUI_Image *img, jint x,
735  jint y, jint rotationX,
736  jint rotationY, jfloat angle,
737  jint alpha) {
738  return UI_DRAWING_STUB_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha);
739 }
740 
741 // See the header file for the function documentation
742 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom3(MICROUI_GraphicsContext *gc,
743  MICROUI_Image *img, jint x,
744  jint y, jint rotationX,
745  jint rotationY, jfloat angle,
746  jint alpha) {
747  return UI_DRAWING_STUB_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha);
748 }
749 
750 // See the header file for the function documentation
751 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom4(MICROUI_GraphicsContext *gc,
752  MICROUI_Image *img, jint x,
753  jint y, jint rotationX,
754  jint rotationY, jfloat angle,
755  jint alpha) {
756  return UI_DRAWING_STUB_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha);
757 }
758 
759 // See the header file for the function documentation
760 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom5(MICROUI_GraphicsContext *gc,
761  MICROUI_Image *img, jint x,
762  jint y, jint rotationX,
763  jint rotationY, jfloat angle,
764  jint alpha) {
765  return UI_DRAWING_STUB_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha);
766 }
767 
768 // See the header file for the function documentation
769 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom6(MICROUI_GraphicsContext *gc,
770  MICROUI_Image *img, jint x,
771  jint y, jint rotationX,
772  jint rotationY, jfloat angle,
773  jint alpha) {
774  return UI_DRAWING_STUB_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha);
775 }
776 
777 // See the header file for the function documentation
778 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor_custom7(MICROUI_GraphicsContext *gc,
779  MICROUI_Image *img, jint x,
780  jint y, jint rotationX,
781  jint rotationY, jfloat angle,
782  jint alpha) {
783  return UI_DRAWING_STUB_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha);
784 }
785 
786 // See the header file for the function documentation
787 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom0(MICROUI_GraphicsContext *gc,
788  MICROUI_Image *img, jint x, jint y,
789  jint rotationX, jint rotationY,
790  jfloat angle, jint alpha) {
791  return UI_DRAWING_STUB_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
792 }
793 
794 // See the header file for the function documentation
795 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom1(MICROUI_GraphicsContext *gc,
796  MICROUI_Image *img, jint x, jint y,
797  jint rotationX, jint rotationY,
798  jfloat angle, jint alpha) {
799  return UI_DRAWING_STUB_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
800 }
801 
802 // See the header file for the function documentation
803 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom2(MICROUI_GraphicsContext *gc,
804  MICROUI_Image *img, jint x, jint y,
805  jint rotationX, jint rotationY,
806  jfloat angle, jint alpha) {
807  return UI_DRAWING_STUB_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
808 }
809 
810 // See the header file for the function documentation
811 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom3(MICROUI_GraphicsContext *gc,
812  MICROUI_Image *img, jint x, jint y,
813  jint rotationX, jint rotationY,
814  jfloat angle, jint alpha) {
815  return UI_DRAWING_STUB_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
816 }
817 
818 // See the header file for the function documentation
819 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom4(MICROUI_GraphicsContext *gc,
820  MICROUI_Image *img, jint x, jint y,
821  jint rotationX, jint rotationY,
822  jfloat angle, jint alpha) {
823  return UI_DRAWING_STUB_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
824 }
825 
826 // See the header file for the function documentation
827 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom5(MICROUI_GraphicsContext *gc,
828  MICROUI_Image *img, jint x, jint y,
829  jint rotationX, jint rotationY,
830  jfloat angle, jint alpha) {
831  return UI_DRAWING_STUB_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
832 }
833 
834 // See the header file for the function documentation
835 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom6(MICROUI_GraphicsContext *gc,
836  MICROUI_Image *img, jint x, jint y,
837  jint rotationX, jint rotationY,
838  jfloat angle, jint alpha) {
839  return UI_DRAWING_STUB_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
840 }
841 
842 // See the header file for the function documentation
843 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear_custom7(MICROUI_GraphicsContext *gc,
844  MICROUI_Image *img, jint x, jint y,
845  jint rotationX, jint rotationY,
846  jfloat angle, jint alpha) {
847  return UI_DRAWING_STUB_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
848 }
849 
850 // See the header file for the function documentation
851 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom0(MICROUI_GraphicsContext *gc,
852  MICROUI_Image *img, jint x,
853  jint y, jfloat factorX,
854  jfloat factorY, jint alpha) {
855  return UI_DRAWING_STUB_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
856 }
857 
858 // See the header file for the function documentation
859 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom1(MICROUI_GraphicsContext *gc,
860  MICROUI_Image *img, jint x,
861  jint y, jfloat factorX,
862  jfloat factorY, jint alpha) {
863  return UI_DRAWING_STUB_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
864 }
865 
866 // See the header file for the function documentation
867 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom2(MICROUI_GraphicsContext *gc,
868  MICROUI_Image *img, jint x,
869  jint y, jfloat factorX,
870  jfloat factorY, jint alpha) {
871  return UI_DRAWING_STUB_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
872 }
873 
874 // See the header file for the function documentation
875 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom3(MICROUI_GraphicsContext *gc,
876  MICROUI_Image *img, jint x,
877  jint y, jfloat factorX,
878  jfloat factorY, jint alpha) {
879  return UI_DRAWING_STUB_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
880 }
881 
882 // See the header file for the function documentation
883 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom4(MICROUI_GraphicsContext *gc,
884  MICROUI_Image *img, jint x,
885  jint y, jfloat factorX,
886  jfloat factorY, jint alpha) {
887  return UI_DRAWING_STUB_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
888 }
889 
890 // See the header file for the function documentation
891 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom5(MICROUI_GraphicsContext *gc,
892  MICROUI_Image *img, jint x,
893  jint y, jfloat factorX,
894  jfloat factorY, jint alpha) {
895  return UI_DRAWING_STUB_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
896 }
897 
898 // See the header file for the function documentation
899 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom6(MICROUI_GraphicsContext *gc,
900  MICROUI_Image *img, jint x,
901  jint y, jfloat factorX,
902  jfloat factorY, jint alpha) {
903  return UI_DRAWING_STUB_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
904 }
905 
906 // See the header file for the function documentation
907 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor_custom7(MICROUI_GraphicsContext *gc,
908  MICROUI_Image *img, jint x,
909  jint y, jfloat factorX,
910  jfloat factorY, jint alpha) {
911  return UI_DRAWING_STUB_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
912 }
913 
914 // See the header file for the function documentation
915 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom0(MICROUI_GraphicsContext *gc,
916  MICROUI_Image *img, jint x, jint y,
917  jfloat factorX, jfloat factorY,
918  jint alpha) {
919  return UI_DRAWING_STUB_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
920 }
921 
922 // See the header file for the function documentation
923 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom1(MICROUI_GraphicsContext *gc,
924  MICROUI_Image *img, jint x, jint y,
925  jfloat factorX, jfloat factorY,
926  jint alpha) {
927  return UI_DRAWING_STUB_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
928 }
929 
930 // See the header file for the function documentation
931 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom2(MICROUI_GraphicsContext *gc,
932  MICROUI_Image *img, jint x, jint y,
933  jfloat factorX, jfloat factorY,
934  jint alpha) {
935  return UI_DRAWING_STUB_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
936 }
937 
938 // See the header file for the function documentation
939 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom3(MICROUI_GraphicsContext *gc,
940  MICROUI_Image *img, jint x, jint y,
941  jfloat factorX, jfloat factorY,
942  jint alpha) {
943  return UI_DRAWING_STUB_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
944 }
945 
946 // See the header file for the function documentation
947 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom4(MICROUI_GraphicsContext *gc,
948  MICROUI_Image *img, jint x, jint y,
949  jfloat factorX, jfloat factorY,
950  jint alpha) {
951  return UI_DRAWING_STUB_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
952 }
953 
954 // See the header file for the function documentation
955 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom5(MICROUI_GraphicsContext *gc,
956  MICROUI_Image *img, jint x, jint y,
957  jfloat factorX, jfloat factorY,
958  jint alpha) {
959  return UI_DRAWING_STUB_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
960 }
961 
962 // See the header file for the function documentation
963 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom6(MICROUI_GraphicsContext *gc,
964  MICROUI_Image *img, jint x, jint y,
965  jfloat factorX, jfloat factorY,
966  jint alpha) {
967  return UI_DRAWING_STUB_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
968 }
969 
970 // See the header file for the function documentation
971 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear_custom7(MICROUI_GraphicsContext *gc,
972  MICROUI_Image *img, jint x, jint y,
973  jfloat factorX, jfloat factorY,
974  jint alpha) {
975  return UI_DRAWING_STUB_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
976 }
977 
978 #else // #if defined(UI_FEATURE_IMAGE_CUSTOM_FORMATS)
979 
980 /*
981  * VEE Port supports only standard images formats: standard (ARGB8888, A8, etc). The
982  * next functions redirect the image drawing to the software algorithms.
983  *
984  * VEE Port may support several destination formats: display format and one or several
985  * standard formats.
986  *
987  * Note: The functions are called by ui_drawing.c. The use of GPU should be checked
988  * in ui_drawing.c and not here.
989  */
990 
991 // --------------------------------------------------------------------------------
992 // Private functions
993 // --------------------------------------------------------------------------------
994 
995 static inline bool _can_call_soft_algo(MICROUI_GraphicsContext *gc) {
996 #if !defined(UI_GC_SUPPORTED_FORMATS) || (UI_GC_SUPPORTED_FORMATS <= 1)
997  (void)gc;
998  // standard image in display GC -> can use soft algo
999  return true;
1000 #else
1001  return LLUI_DISPLAY_isDisplayFormat(gc->image.format);
1002 #endif
1003 }
1004 
1005 // --------------------------------------------------------------------------------
1006 // ui_image_drawing.h functions
1007 // --------------------------------------------------------------------------------
1008 
1009 // See the header file for the function documentation
1010 DRAWING_Status UI_IMAGE_DRAWING_draw(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
1011  jint width, jint height, jint x, jint y, jint alpha) {
1012  return _can_call_soft_algo(gc) ?
1013  UI_DRAWING_SOFT_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha)
1014  : UI_DRAWING_STUB_drawImage(gc, img, regionX, regionY, width, height, x, y, alpha);
1015 }
1016 
1017 // See the header file for the function documentation
1018 DRAWING_Status UI_IMAGE_DRAWING_copy(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
1019  jint width, jint height, jint x, jint y) {
1020  return _can_call_soft_algo(gc) ?
1021  UI_DRAWING_SOFT_copyImage(gc, img, regionX, regionY, width, height, x, y)
1022  : UI_DRAWING_STUB_copyImage(gc, img, regionX, regionY, width, height, x, y);
1023 }
1024 
1025 // See the header file for the function documentation
1026 DRAWING_Status UI_IMAGE_DRAWING_drawRegion(MICROUI_GraphicsContext *gc, jint regionX, jint regionY, jint width,
1027  jint height, jint x, jint y, jint alpha) {
1028  return _can_call_soft_algo(gc) ?
1029  UI_DRAWING_SOFT_drawRegion(gc, regionX, regionY, width, height, x, y, alpha)
1030  : UI_DRAWING_STUB_drawRegion(gc, regionX, regionY, width, height, x, y, alpha);
1031 }
1032 
1033 // See the header file for the function documentation
1034 DRAWING_Status UI_IMAGE_DRAWING_drawFlipped(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
1035  jint width, jint height, jint x, jint y, DRAWING_Flip transformation,
1036  jint alpha) {
1037  return _can_call_soft_algo(gc) ?
1038  DW_DRAWING_SOFT_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha)
1039  : UI_DRAWING_STUB_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y, transformation, alpha);
1040 }
1041 
1042 // See the header file for the function documentation
1043 DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x,
1044  jint y, jint rotationX, jint rotationY, jfloat angle,
1045  jint alpha) {
1046  return _can_call_soft_algo(gc) ?
1047  DW_DRAWING_SOFT_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha)
1048  : UI_DRAWING_STUB_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle, alpha);
1049 }
1050 
1051 // See the header file for the function documentation
1052 DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
1053  jint rotationX, jint rotationY, jfloat angle, jint alpha) {
1054  return _can_call_soft_algo(gc) ?
1055  DW_DRAWING_SOFT_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha)
1056  : UI_DRAWING_STUB_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
1057 }
1058 
1059 // See the header file for the function documentation
1060 DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x,
1061  jint y, jfloat factorX, jfloat factorY, jint alpha) {
1062  return _can_call_soft_algo(gc) ?
1063  DW_DRAWING_SOFT_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha)
1064  : UI_DRAWING_STUB_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
1065 }
1066 
1067 // See the header file for the function documentation
1068 DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
1069  jfloat factorX, jfloat factorY, jint alpha) {
1070  return _can_call_soft_algo(gc) ?
1071  DW_DRAWING_SOFT_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha)
1072  : UI_DRAWING_STUB_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
1073 }
1074 
1075 #endif // #if defined(UI_FEATURE_IMAGE_CUSTOM_FORMATS)
1076 
1077 // --------------------------------------------------------------------------------
1078 // EOF
1079 // --------------------------------------------------------------------------------
MicroEJ MicroUI library low level API: enable some features according to the hardware capabilities.