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