microui  4.0.1
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.0.1
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, jint width, jint height, jint x, jint y, jint alpha);
63 
64 /*
65  * @brief Copy a region of an image in another image with the same pixel format.
66  * @see UI_DRAWING_copyImage
67  */
68 DRAWING_Status UI_IMAGE_DRAWING_copy(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint regionX, jint regionY, jint width, jint height, jint x, jint y);
69 
70 /*
71  * @brief Draw a region of an image in the same image.
72  * @see UI_DRAWING_drawRegion
73  */
74 DRAWING_Status UI_IMAGE_DRAWING_drawRegion(MICROUI_GraphicsContext* gc, jint regionX, jint regionY, jint width, jint height, jint x, jint y, jint alpha);
75 
76 /*
77  * @brief Draws an image applying a flip.
78  * @see UI_DRAWING_drawFlippedImage
79  */
80 DRAWING_Status UI_IMAGE_DRAWING_drawFlipped(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint regionX, jint regionY, jint width, jint height, jint x, jint y, DRAWING_Flip transformation, jint alpha);
81 
82 /*
83  * @brief Draws an image applying a free rotation (0 to 360 degrees).
84  * @see UI_DRAWING_drawRotatedImageNearestNeighbor
85  */
86 DRAWING_Status UI_IMAGE_DRAWING_drawRotatedNearestNeighbor(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jint rotationX, jint rotationY, jfloat angle, jint alpha);
87 
88 /*
89  * @brief Draws an image applying a free rotation (0 to 360 degrees).
90  * @see UI_DRAWING_drawRotatedImageBilinear
91  */
92 DRAWING_Status UI_IMAGE_DRAWING_drawRotatedBilinear(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jint rotationX, jint rotationY, jfloat angle, jint alpha);
93 
94 /*
95  * @brief Draws an image applying a scaling.
96  * @see UI_DRAWING_drawScaledImageNearestNeighbor
97  */
98 DRAWING_Status UI_IMAGE_DRAWING_drawScaledNearestNeighbor(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jfloat factorX, jfloat factorY, jint alpha);
99 
100 /*
101  * @brief Draws an image applying a scaling.
102  * @see UI_DRAWING_drawScaledImageBilinear
103  */
104 DRAWING_Status UI_IMAGE_DRAWING_drawScaledBilinear(MICROUI_GraphicsContext* gc, MICROUI_Image* img, jint x, jint y, jfloat factorX, jfloat factorY, jint alpha);
105 
106 // --------------------------------------------------------------------------------
107 // EOF
108 // --------------------------------------------------------------------------------
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 #endif // UI_IMAGE_DRAWING_H