microvg  3.0.1
microvg
vg_drawing.h
1 /*
2  * Copyright 2023 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 VG_DRAWING_H
7 #define VG_DRAWING_H
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 
13 /*
14  * @brief Provides drawing functions called by MicroVG native drawing functions.
15  *
16  * This header file follows strictly the same concept as ui_drawing.h but for MicroVG
17  * library.
18  *
19  * @see ui_drawing.h
20  */
21 
22 // --------------------------------------------------------------------------------
23 // Includes
24 // --------------------------------------------------------------------------------
25 
26 #include <LLVG_PAINTER_impl.h>
27 
28 #include "ui_drawing.h"
29 
30 // --------------------------------------------------------------------------------
31 // API
32 // --------------------------------------------------------------------------------
33 
34 /*
35  * @brief Gets the image size. The image structure format is VEE Port specific.
36  *
37  * @param[in] image: the image
38  * @param[out] width: the image width
39  * @param[out] height: the image height
40  */
41 void VG_DRAWING_get_image_size(void* image, float* width, float* height);
42 
43 /*
44  * @brief Draws a path filled with the specified color (not the one of the Graphics Context).
45  *
46  * @param[in] gc: the destination
47  * @param[in] path: the path's data
48  * @param[in] x: the destination X coordinate
49  * @param[in] y: the destination Y coordinate
50  * @param[in] matrix: the deformation to apply
51  * @param[in] fillRule: the fill type
52  * @param[in] blend: the blend mode
53  * @param[in] color: the color to apply (with an opacity)
54  *
55  * @return the drawing status.
56  */
57 DRAWING_Status VG_DRAWING_drawPath(MICROUI_GraphicsContext* gc, jbyte* path, jint x, jint y, jfloat* matrix, jint fillRule, jint blend, jint color);
58 
59 /*
60  * @brief Draws a path filled with a linear gradient.
61  *
62  * @param[in] gc: the destination
63  * @param[in] path: the path's data
64  * @param[in] x: the destination X coordinate
65  * @param[in] y: the destination Y coordinate
66  * @param[in] matrix: the deformation to apply
67  * @param[in] fillRule: the fill type
68  * @param[in] alpha: the global opacity to apply
69  * @param[in] blend: the blend mode
70  * @param[in] gradient: the gradient to apply
71  * @param[in] gradientMatrix: the gradient deformation, may be null (means identity)
72  *
73  * @return the drawing status.
74  */
75 DRAWING_Status VG_DRAWING_drawGradient(MICROUI_GraphicsContext* gc, jbyte* path, jint x, jint y, jfloat* matrix, jint fillRule, jint alpha, jint blend, jint* gradient, jfloat* gradientMatrix);
76 
77 /*
78  * @brief Draws a string with the color of the Graphics Context.
79  *
80  * The top/left position of the first drawn character is placed at
81  * coordinate x/y.
82  *
83  * @param[in] gc the MicroUI GraphicsContext target.
84  * @param[in] text the array of characters to draw.
85  * @param[in] faceHandle the font reference handle.
86  * @param[in] size the height of the font in pixels.
87  * @param[in] x the horizontal coordinate of the top/left of the first drawn character.
88  * @param[in] y the vertical coordinate of the top/left of the first drawn character.
89  * @param[in] matrix: deformation matrix, may be null (means identity)
90  * @param[in] alpha the opacity level to apply to the character.
91  * @param[in] blend the blend mode to use
92  * @param[in] letterSpacing the extra letter spacing to use
93  *
94  * @return the drawing status.
95  */
96 DRAWING_Status VG_DRAWING_drawString(MICROUI_GraphicsContext* gc, jchar* text, jint faceHandle, jfloat size, jfloat x, jfloat y, jfloat* matrix, jint alpha, jint blend, jfloat letterSpacing);
97 
98 /*
99  * @brief Draws a string with a linear gradient.
100  *
101  * @param[in] gc the MicroUI GraphicsContext target.
102  * @param[in] text the array of characters to draw.
103  * @param[in] faceHandle the font reference handle.
104  * @param[in] size the height of the font in pixels.
105  * @param[in] x the horizontal coordinate of the top/left of the first drawn character.
106  * @param[in] y the vertical coordinate of the top/left of the first drawn character.
107  * @param[in] matrix: deformation matrix, may be null (means identity)
108  * @param[in] alpha the opacity level to apply to the character.
109  * @param[in] blend the blend mode to use
110  * @param[in] letterSpacing the extra letter spacing to use
111  * @param[in] gradientData the gradient to apply
112  * @param[in] gradientMatrix the gradient deformation, may be null (means identity)
113  *
114  * @return the drawing status.
115  */
116 DRAWING_Status VG_DRAWING_drawStringGradient(MICROUI_GraphicsContext* gc, jchar* text, jint faceHandle, jfloat size, jfloat x, jfloat y, jfloat* matrix, jint alpha, jint blend, jfloat letterSpacing, jint *gradientData, jfloat *gradientMatrix);
117 
118 /*
119  * @brief Draws a string along a circle, with the color of the Graphics Context.
120  *
121  * @param[in] gc the MicroUI GraphicsContext target.
122  * @param[in] text the array of characters to draw.
123  * @param[in] faceHandle the font reference handle.
124  * @param[in] size the height of the font in pixels.
125  * @param[in] x the horizontal coordinate of the top/left of the first drawn character.
126  * @param[in] y the vertical coordinate of the top/left of the first drawn character.
127  * @param[in] matrix: deformation matrix, may be null (means identity)
128  * @param[in] alpha the opacity level to apply to the character.
129  * @param[in] blend the blend mode to use
130  * @param[in] letterSpacing the extra letter spacing to use
131  * @param[in] radius the radius of the circle
132  * @param[in] direction the direction of the text along the circle
133  *
134  * @return the drawing status.
135  */
136 DRAWING_Status VG_DRAWING_drawStringOnCircle(MICROUI_GraphicsContext* gc, jchar* text, jint faceHandle, jfloat size, jint x, jint y, jfloat* matrix, jint alpha, jint blend, jfloat letterSpacing, jfloat radius, jint direction);
137 
138 /*
139  * @brief Draws a string along a circle, with a linear gradient.
140  *
141  * @param[in] gc the MicroUI GraphicsContext target.
142  * @param[in] text the array of characters to draw.
143  * @param[in] faceHandle the font reference handle.
144  * @param[in] size the height of the font in pixels.
145  * @param[in] x the horizontal coordinate of the top/left of the first drawn character.
146  * @param[in] y the vertical coordinate of the top/left of the first drawn character.
147  * @param[in] matrix: deformation matrix, may be null (means identity)
148  * @param[in] alpha the opacity level to apply to the character.
149  * @param[in] blend the blend mode to use
150  * @param[in] letterSpacing the extra letter spacing to use
151  * @param[in] radius the radius of the circle
152  * @param[in] direction the direction of the text along the circle
153  * @param[in] gradientData the gradient to apply
154  * @param[in] gradientMatrix the gradient deformation, may be null (means identity)
155  *
156  * @return the drawing status.
157  */
158 DRAWING_Status VG_DRAWING_drawStringOnCircleGradient(MICROUI_GraphicsContext* gc, jchar* text, jint faceHandle, jfloat size, jint x, jint y, jfloat* matrix, jint alpha, jint blend, jfloat letterSpacing, jfloat radius, jint direction, jint *gradientData, jfloat *gradientMatrix);
159 
160 /*
161  * @brief Draws an image with transformation and opacity. Optionally apply an animation and / or a color filtering.
162  *
163  * @param[in] gc the graphics context to draw on
164  * @param[in] image the image to draw
165  * @param[in] matrix the transformation matrix to apply
166  * @param[in] alpha the global opacity rendering value
167  * @param[in] elapsedTime the elapsed time since the beginning of the animation, in milliseconds
168  * @param[in] colorMatrix the color matrix used to transform colors, may be null (means no color deformation)
169  * @param[out] errno the error code to return to MicroVG.
170  *
171  * @return the drawing status.
172  */
173 DRAWING_Status VG_DRAWING_drawImage(MICROUI_GraphicsContext* gc, void* image, jfloat *matrix, jint alpha, jlong elapsed, const float color_matrix[], jint* errno) ;
174 
175 // --------------------------------------------------------------------------------
176 // EOF
177 // --------------------------------------------------------------------------------
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 #endif // VG_DRAWING_H