hal_gfx_transitions.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file hal_gfx_transitions.h
5  * @author BLE Driver Team
6  * @brief Header file containing functions prototypes of Graphics library.
7  *
8  ****************************************************************************************
9  * @attention
10  #####Copyright (c) 2019 GOODIX
11  All rights reserved.
12 
13  Redistribution and use in source and binary forms, with or without
14  modification, are permitted provided that the following conditions are met:
15  * Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17  * Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20  * Neither the name of GOODIX nor the names of its contributors may be used
21  to endorse or promote products derived from this software without
22  specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35  ****************************************************************************************
36  */
37 
38 /** @addtogroup GRAPHICS_SDK Graphics
39  * @{
40  */
41 
42 /** @addtogroup HAL_GFX HAL GFX
43  * @{
44  */
45 
46 /** @defgroup HAL_GFX_TRANSITIONS GFX_TRANSITIONS
47  * @brief GPU transitions.
48  * @{
49  */
50 
51 #ifndef HAL_GFX_TRANSITIONS_H__
52 #define HAL_GFX_TRANSITIONS_H__
53 
54 #include "hal_gfx_blender.h"
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 /**
61  * @defgroup HAL_GFX_TRANSITIONS_ENUM Enumerations
62  * @{
63  */
64 /**@brief Definition of transition effect. */
65 typedef enum {
66  HAL_GFX_TRANS_LINEAR_H, /**< Linear transition horizontally. */
67  HAL_GFX_TRANS_CUBE_H, /**< Cubic transition horizontally. */
68  HAL_GFX_TRANS_INNERCUBE_H, /**< Inner Cube transition horizontally. */
69  HAL_GFX_TRANS_STACK_H, /**< Stack transition horizontally. */
70  HAL_GFX_TRANS_LINEAR_V, /**< Linear transition vertically. */
71  HAL_GFX_TRANS_CUBE_V, /**< Cubic transition vertically. */
72  HAL_GFX_TRANS_INNERCUBE_V, /**< Inner Cube transition vertically. */
73  HAL_GFX_TRANS_STACK_V, /**< Stack transition vertically. */
74  HAL_GFX_TRANS_FADE, /**< Fade transition. */
75  HAL_GFX_TRANS_FADE_ZOOM, /**< Fade-zoom transition. */
76  HAL_GFX_TRANS_COVER, /**< Cover transition. */
77  HAL_GFX_TRANS_SPIN_H_R2L, /**< Spin from Right to Left(ClockWise) horizontally */
78  HAL_GFX_TRANS_SPIN_H_L2R, /**< Spin from Left to Right(Counter-ClockWise) horizontally */
79  HAL_GFX_TRANS_PUSHPULL_H, /**< Linear transition with a depth of field effect, horizontal.*/
80  HAL_GFX_TRANS_PUSHPULL_V, /**< Linear transition with a depth of field effect, horizontal.*/
81  HAL_GFX_TRANS_MAX, /**< MAX. */
82  HAL_GFX_TRANS_NONE, /**< NONE. */
84 /** @} */
85 
86 /**
87  * @defgroup HAL_GFX_TRANSITIONS_FUNCTION Functions
88  * @{
89  */
90 /**
91  *****************************************************************************************
92  * @brief Transition from 'initial' texture to 'final' texture. The transition is complete when 'step' is 0 or 1
93  *
94  * @param[in] effect: Transition effect
95  * @param[in] initial: Initial texture
96  * @param[in] final: Final texture
97  * @param[in] blending_mode: Blending mode
98  * @param[in] step: Transition step within [0.f , 1.f] range
99  * @param[in] width: Texture width
100  * @param[in] height: Texture height
101  *
102  */
104  uint32_t blending_mode, float step, int width, int height);
105 
106 /**
107  *****************************************************************************************
108  * @brief Linear transition horizontally. When 'step' changes from zero to one, textures move from right to left,
109  * otherwise textures move from left to right. The transition is complete when 'step' is 0 or 1.
110  *
111  * @param[in] left: Texture on the left side
112  * @param[in] right: Texture on the right side
113  * @param[in] blending_mode: Blending mode
114  * @param[in] step: Current step within [0.f , 1.f] range
115  * @param[in] width: Texture width
116  *
117  *****************************************************************************************
118  */
120  uint32_t blending_mode, float step, int width);
121 
122 /**
123  *****************************************************************************************
124  * @brief Linear transition vertically. When 'step' changes from zero to one, textures move from top to bottom,
125  * otherwise textures move from bottom to top. The transition is complete when 'step' is 0 or 1.
126  *
127  * @param[in] up: Texture on the top side
128  * @param[in] down: Texture on the bottom side
129  * @param[in] blending_mode: Blending mode
130  * @param[in] step: Current step within [0.f , 1.f] range
131  * @param[in] height: Texture height
132  *
133  *****************************************************************************************
134  */
136  uint32_t blending_mode, float step, int height);
137 
138 /**
139  *****************************************************************************************
140  * @brief Cubic (textures are mapped on the external faces of a cube) transition horizontally. When 'step' changes from zero to one, textures move from left to right,
141  * otherwise textures move from right to left. The transition is complete when 'step' is 0 or 1.
142  *
143  * @param[in] left: Texture on the left side
144  * @param[in] right: Texture on the right side
145  * @param[in] blending_mode; Blending mode
146  * @param[in] step: Current step within [0.f , 1.f] range
147  * @param[in] width: Texture width
148  * @param[in] height: Texture height
149  *
150  *****************************************************************************************
151  */
153  uint32_t blending_mode, float step, int width, int height);
154 
155 /**
156  *****************************************************************************************
157  * @brief Cube (textures are mapped on the external faces of a cube) transition vertically. When 'step' changes from zero to one, textures move from top to bottom,
158  * otherwise textures move from bottom to top. The transition is complete when 'step' is 0 or 1.
159  *
160  * @param[in] up: Texture on the top side
161  * @param[in] down: Texture on the bottom side
162  * @param[in] blending_mode: Blending mode
163  * @param[in] step: Current step within [0.f , 1.f] range
164  * @param[in] width: Texture width
165  * @param[in] height: Texture height
166  *
167  *****************************************************************************************
168  */
170  uint32_t blending_mode, float step, int width, int height);
171 
172 /**
173  *****************************************************************************************
174  * @brief Inner Cube (textures are mapped on the internal faces of a cube) transition horizontally. When 'step' changes from zero to one, textures move from left to right,
175  * otherwise textures move from right to left. The transition is complete when 'step' is 0 or 1.
176  *
177  * @param[in] left: Texture on the left side
178  * @param[in] right: Texture on the right side
179  * @param[in] blending_mode: Blending mode
180  * @param[in] step: Current step within [0.f , 1.f] range
181  * @param[in] width: Texture width
182  * @param[in] height: Texture height
183  *
184  *****************************************************************************************
185  */
187  uint32_t blending_mode, float step, int width, int height);
188 
189 /**
190  *****************************************************************************************
191  * @brief Inner Cube (textures are mapped on the internal faces of a cube) transition vertically. When 'step' changes from zero to one, textures move from top to bottom,
192  * otherwise textures move from bottom to top. The transition The transition is complete when 'step' is 0 or 1.
193  *
194  * @param[in] up: Texture on the top side
195  * @param[in] down: Texture on the bottom side
196  * @param[in] blending_mode: Blending mode
197  * @param[in] step: Current step within [0.f , 1.f] range
198  * @param[in] width: Texture width
199  * @param[in] height: Texture height
200  *
201  *****************************************************************************************
202  */
204  uint32_t blending_mode, float step, int width, int height);
205 
206 /**
207  *****************************************************************************************
208  * @brief Stack transition horizontally. When 'step' changes from zero to one, textures move from left to right,
209  * otherwise textures move from right to left. The transition is complete when 'step' is 0 or 1.
210  *
211  * @param[in] left: Texture on the left side
212  * @param[in] right: Texture on the right side
213  * @param[in] step: Current step within [0.f , 1.f] range
214  * @param[in] width: Texture width
215  * @param[in] height: Texture height
216  *
217  *****************************************************************************************
218  */
220  int width, int height);
221 
222 /**
223  *****************************************************************************************
224  * @brief Stack transition vertically. When 'step' moves from zero to one, textures move from top to bottom,
225  * otherwise textures move from bottom to top. The transition is complete when 'step' is 0 or 1.
226  *
227  * @param[in] up: Texture on the top side
228  * @param[in] down: Texture on the bottom side
229  * @param[in] step: Current step within [0.f , 1.f] range
230  * @param[in] width: Texture width
231  * @param[in] height: Texture height
232  *
233  *****************************************************************************************
234  */
236  int width, int height);
237 
238 /**
239  *****************************************************************************************
240  * @brief Fade transition. Initial texture is being faded out, while final texture is being faded in.
241  * The transition is complete when 'step' is 0 or 1.
242  *
243  * @param[in] initial: Texture initial
244  * @param[in] final: Texture final
245  * @param[in] blending_mode: Blending mode
246  * @param[in] step: Current step within [0.f , 1.f] range
247  * @param[in] width: Texture width
248  * @param[in] height: Texture height
249  *
250  *****************************************************************************************
251  */
253  uint32_t blending_mode, float step, int width, int height);
254 
255 /**
256  *****************************************************************************************
257  * @brief Fade-zoom transition. Initial texture is being zoomed and faded out, while final texture is being zoomed and faded in.
258  * The transition is complete when 'step' is 0 or 1.
259  *
260  * @param[in] initial: Initial texture
261  * @param[in] final: Final texture
262  * @param[in] blending_mode: Blending mode
263  * @param[in] step: Current step within [0.f , 1.f] range
264  * @param[in] width: Texture width
265  * @param[in] height: Texture height
266  *
267  *****************************************************************************************
268  */
270  uint32_t blending_mode, float step, int width, int height);
271 
272 /**
273  *****************************************************************************************
274  * @brief Spin around Y-Axis transition .
275  * The transition is complete when 'step' is 0 or 1.
276  *
277  * @param[in] front: front texture
278  * @param[in] back : back texture
279  * @param[in] blending_mode: Blending mode
280  * @param[in] step: Current step within [0.f , 1.f] range, [0, 0.5] - show front texture; (0.5, 1], show back texture
281  * @param[in] width: Texture width
282  * @param[in] height: Texture height
283  * @param[in] is_clockwise: Spin by clockwise or counter-clockwise
284  *
285  *****************************************************************************************
286  */
288  uint32_t blending_mode, float step,
289  int width, int height, bool is_clockwise);
290 
291 /**
292  *****************************************************************************************
293  * @brief Push-pull transition horizontally. This is a variation of linear transition with some field-of-depth effect.
294  * The transition is complete when 'step' is 0 or 1.
295  *
296  * @param[in] initial: Initial texture
297  * @param[in] final: Final texture
298  * @param[in] blending_mode: Blending mode
299  * @param[in] step: Current step within [0.f , 1.f] range
300  * @param[in] width: Texture width
301  * @param[in] height: Texture height
302  *
303  *****************************************************************************************
304  */
306  uint32_t blending_mode, float step, int width, int height);
307 
308 /**
309  *****************************************************************************************
310  * @brief Push-pull transition vertically. This is a variation of linear transition with some field-of-depth effect.
311  * The transition is complete when 'step' is 0 or 1.
312  *
313  * @param[in] initial: Initial texture
314  * @param[in] final: Final texture
315  * @param[in] blending_mode: Blending mode
316  * @param[in] step: Current step within [0.f , 1.f] range
317  * @param[in] width: Texture width
318  * @param[in] height: Texture height
319  *
320  *****************************************************************************************
321  */
323  uint32_t blending_mode, float step, int width, int height);
324 /** @} */
325 
326 #ifdef __cplusplus
327 }
328 #endif
329 
330 #endif
331 
332 /** @} */
333 /** @} */
334 /** @} */
335 
HAL_GFX_TRANS_MAX
@ HAL_GFX_TRANS_MAX
MAX.
Definition: hal_gfx_transitions.h:81
HAL_GFX_TRANS_FADE
@ HAL_GFX_TRANS_FADE
Fade transition.
Definition: hal_gfx_transitions.h:74
hal_gfx_transition_spin_hor
void hal_gfx_transition_spin_hor(hal_gfx_tex_t front, hal_gfx_tex_t back, uint32_t blending_mode, float step, int width, int height, bool is_clockwise)
Spin around Y-Axis transition .
hal_gfx_transition
void hal_gfx_transition(hal_gfx_transition_t effect, hal_gfx_tex_t initial, hal_gfx_tex_t final, uint32_t blending_mode, float step, int width, int height)
Transition from 'initial' texture to 'final' texture.
hal_gfx_transition_t
hal_gfx_transition_t
Definition of transition effect.
Definition: hal_gfx_transitions.h:65
hal_gfx_blender.h
Header file containing functions prototypes of Graphics library.
hal_gfx_transition_pushpull_ver
void hal_gfx_transition_pushpull_ver(hal_gfx_tex_t initial, hal_gfx_tex_t final, uint32_t blending_mode, float step, int width, int height)
Push-pull transition vertically.
HAL_GFX_TRANS_NONE
@ HAL_GFX_TRANS_NONE
NONE.
Definition: hal_gfx_transitions.h:82
HAL_GFX_TRANS_SPIN_H_L2R
@ HAL_GFX_TRANS_SPIN_H_L2R
Spin from Left to Right(Counter-ClockWise) horizontally.
Definition: hal_gfx_transitions.h:78
HAL_GFX_TRANS_LINEAR_V
@ HAL_GFX_TRANS_LINEAR_V
Linear transition vertically.
Definition: hal_gfx_transitions.h:70
hal_gfx_transition_linear_hor
void hal_gfx_transition_linear_hor(hal_gfx_tex_t left, hal_gfx_tex_t right, uint32_t blending_mode, float step, int width)
Linear transition horizontally.
HAL_GFX_TRANS_INNERCUBE_H
@ HAL_GFX_TRANS_INNERCUBE_H
Inner Cube transition horizontally.
Definition: hal_gfx_transitions.h:68
HAL_GFX_TRANS_CUBE_V
@ HAL_GFX_TRANS_CUBE_V
Cubic transition vertically.
Definition: hal_gfx_transitions.h:71
HAL_GFX_TRANS_SPIN_H_R2L
@ HAL_GFX_TRANS_SPIN_H_R2L
Spin from Right to Left(ClockWise) horizontally.
Definition: hal_gfx_transitions.h:77
hal_gfx_transition_pushpull_hor
void hal_gfx_transition_pushpull_hor(hal_gfx_tex_t initial, hal_gfx_tex_t final, uint32_t blending_mode, float step, int width, int height)
Push-pull transition horizontally.
HAL_GFX_TRANS_STACK_V
@ HAL_GFX_TRANS_STACK_V
Stack transition vertically.
Definition: hal_gfx_transitions.h:73
HAL_GFX_TRANS_PUSHPULL_H
@ HAL_GFX_TRANS_PUSHPULL_H
Linear transition with a depth of field effect, horizontal.
Definition: hal_gfx_transitions.h:79
hal_gfx_transition_cube_ver
void hal_gfx_transition_cube_ver(hal_gfx_tex_t up, hal_gfx_tex_t down, uint32_t blending_mode, float step, int width, int height)
Cube (textures are mapped on the external faces of a cube) transition vertically.
HAL_GFX_TRANS_CUBE_H
@ HAL_GFX_TRANS_CUBE_H
Cubic transition horizontally.
Definition: hal_gfx_transitions.h:67
HAL_GFX_TRANS_FADE_ZOOM
@ HAL_GFX_TRANS_FADE_ZOOM
Fade-zoom transition.
Definition: hal_gfx_transitions.h:75
HAL_GFX_TRANS_STACK_H
@ HAL_GFX_TRANS_STACK_H
Stack transition horizontally.
Definition: hal_gfx_transitions.h:69
hal_gfx_transition_cube_hor
void hal_gfx_transition_cube_hor(hal_gfx_tex_t left, hal_gfx_tex_t right, uint32_t blending_mode, float step, int width, int height)
Cubic (textures are mapped on the external faces of a cube) transition horizontally.
hal_gfx_transition_stack_ver
void hal_gfx_transition_stack_ver(hal_gfx_tex_t up, hal_gfx_tex_t down, float step, int width, int height)
Stack transition vertically.
hal_gfx_transition_fade_zoom
void hal_gfx_transition_fade_zoom(hal_gfx_tex_t initial, hal_gfx_tex_t final, uint32_t blending_mode, float step, int width, int height)
Fade-zoom transition.
HAL_GFX_TRANS_LINEAR_H
@ HAL_GFX_TRANS_LINEAR_H
Linear transition horizontally.
Definition: hal_gfx_transitions.h:66
hal_gfx_transition_innercube_ver
void hal_gfx_transition_innercube_ver(hal_gfx_tex_t up, hal_gfx_tex_t down, uint32_t blending_mode, float step, int width, int height)
Inner Cube (textures are mapped on the internal faces of a cube) transition vertically.
HAL_GFX_TRANS_COVER
@ HAL_GFX_TRANS_COVER
Cover transition.
Definition: hal_gfx_transitions.h:76
HAL_GFX_TRANS_INNERCUBE_V
@ HAL_GFX_TRANS_INNERCUBE_V
Inner Cube transition vertically.
Definition: hal_gfx_transitions.h:72
HAL_GFX_TRANS_PUSHPULL_V
@ HAL_GFX_TRANS_PUSHPULL_V
Linear transition with a depth of field effect, horizontal.
Definition: hal_gfx_transitions.h:80
hal_gfx_transition_fade
void hal_gfx_transition_fade(hal_gfx_tex_t initial, hal_gfx_tex_t final, uint32_t blending_mode, float step, int width, int height)
Fade transition.
hal_gfx_transition_innercube_hor
void hal_gfx_transition_innercube_hor(hal_gfx_tex_t left, hal_gfx_tex_t right, uint32_t blending_mode, float step, int width, int height)
Inner Cube (textures are mapped on the internal faces of a cube) transition horizontally.
hal_gfx_transition_linear_ver
void hal_gfx_transition_linear_ver(hal_gfx_tex_t up, hal_gfx_tex_t down, uint32_t blending_mode, float step, int height)
Linear transition vertically.
hal_gfx_tex_t
hal_gfx_tex_t
Graphics Texture.
Definition: hal_gfx_graphics.h:69
hal_gfx_transition_stack_hor
void hal_gfx_transition_stack_hor(hal_gfx_tex_t left, hal_gfx_tex_t right, float step, int width, int height)
Stack transition horizontally.