microui  14.1.0
microui
ui_image_drawing.h
1 /*
2  * Copyright 2023-2024 MicroEJ Corp. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be found with this software.
4  */
5 
6 #if !defined UI_IMAGE_DRAWING_H
7 #define UI_IMAGE_DRAWING_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*
14  * @brief Provides image drawing functions called by ui_drawing.c.
15  *
16  * The default weak functions of ui_drawing.c call the ui_image_drawing.h functions to draw
17  * the image. According to the kind of image (standard or custom), the implementation
18  * of ui_image_drawing.h calls the right image manager functions.
19  *
20  * When the image is a standard image, the implementation calls the Graphics Engine
21  * software algorithms.
22  *
23  * When the image is a custom image, the associated image manager is mandatory (the
24  * Graphics Engine is not able to decode this custom image). The implementation
25  * dispatches the image drawing to this image manager (the custom image manager is
26  * retrieved thanks to the custom image format: MICROUI_IMAGE_FORMAT_CUSTOM_0 to
27  * MICROUI_IMAGE_FORMAT_CUSTOM_7).
28  *
29  * Several cases:
30  *
31  * 1- The image manager is available and it is able to draw in the given Graphics
32  * Context: it has to decode the image and draw into the Graphics Context.
33  *
34  * 2- The image manager is available and the given Graphics Context format is the
35  * same format as the image: the image should be copied in the destination.
36  *
37  * 3- The image manager is available and it is not able to draw in the given Graphics
38  * Context (unknown ouput format) but it is able to draw the image into the Graphics
39  * Context by using the ui_drawing.h functions.
40  *
41  * 4- The image manager is available, it is not able to draw in the given Graphics
42  * Context (unknown ouput format) and it is not able to call standard ui_drawing.h
43  * functions to draw the image: it has to call the stub implementation.
44  *
45  * @author MicroEJ Developer Team
46  * @version 14.1.0
47  */
48 
49 // --------------------------------------------------------------------------------
50 // Includes
51 // --------------------------------------------------------------------------------
52 
53 #include "ui_drawing.h"
54 
55 // --------------------------------------------------------------------------------
56 // API
57 // --------------------------------------------------------------------------------
58 
59 /*
60  * @brief Draws a region of an image.
61  * @see UI_DRAWING_drawImage
62  */
63 DRAWING_Status UI_IMAGE_DRAWING_draw(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
64  jint width, jint height, jint x, jint y, jint alpha);
65 
66 /*
67  * @brief Copy a region of an image in another image with the same pixel format.
68  * @see UI_DRAWING_copyImage
69  */
70 DRAWING_Status UI_IMAGE_DRAWING_copy(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
71  jint width, jint height, jint x, jint y);
72 
73 /*
74  * @brief Draw a region of an image in the same image.
75  * @see UI_DRAWING_drawRegion
76  */
77 DRAWING_Status UI_IMAGE_DRAWING_drawRegion(MICROUI_GraphicsContext *gc, jint regionX, jint regionY, jint width,
78  jint height, jint x, jint y, jint alpha);
79 
80 /*
81  * @brief Draws an image applying a flip.
82  * @see UI_DRAWING_drawFlippedImage
83  */
84 DRAWING_Status UI_IMAGE_DRAWING_drawFlipped(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
85  jint width, jint height, jint x, jint y, DRAWING_Flip transformation,
86  jint alpha);
87 
88 /*
89  * @brief Draws an image applying a free rotation (0 to 360 degrees).
90  * @see UI_DRAWING_drawRotatedImageNearestNeighbor
91  */
92 DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x,
93  jint y, jint rotationX, jint rotationY, jfloat angle,
94  jint alpha);
95 
96 /*
97  * @brief Draws an image applying a free rotation (0 to 360 degrees).
98  * @see UI_DRAWING_drawRotatedImageBilinear
99  */
100 DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
101  jint rotationX, jint rotationY, jfloat angle, jint alpha);
102 
103 /*
104  * @brief Draws an image applying a scaling.
105  * @see UI_DRAWING_drawScaledImageNearestNeighbor
106  */
107 DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x,
108  jint y, jfloat factorX, jfloat factorY, jint alpha);
109 
110 /*
111  * @brief Draws an image applying a scaling.
112  * @see UI_DRAWING_drawScaledImageBilinear
113  */
114 DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
115  jfloat factorX, jfloat factorY, jint alpha);
116 
117 // --------------------------------------------------------------------------------
118 // EOF
119 // --------------------------------------------------------------------------------
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif // UI_IMAGE_DRAWING_H