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