1 /* TSI 2023.xmo */
2 /*******************************************************************************
3  * Copyright (c) 2023 Think Silicon Single Member PC
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this header file and/or associated documentation files to use, copy,
7  * modify, merge, publish, distribute, sublicense, and/or sell copies of the
8  * Materials, and to permit persons to whom the Materials are furnished to do
9  * so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Materials.
13  *
14  * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
15  * NEMAGFX API. THE UNMODIFIED, NORMATIVE VERSIONS OF THINK-SILICON NEMAGFX
16  * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT:
17  *   https://think-silicon.com/products/software/nemagfx-api
18  *
19  *  The software is provided 'as is', without warranty of any kind, express or
20  *  implied, including but not limited to the warranties of merchantability,
21  *  fitness for a particular purpose and noninfringement. In no event shall
22  *  Think Silicon Single Member PC be liable for any claim, damages or other
23  *  liability, whether in an action of contract, tort or otherwise, arising
24  *  from, out of or in connection with the software or the use or other dealings
25  *  in the software.
26  ******************************************************************************/
27 
28 
29 #ifndef NEMA_TRANSITIONS_H__
30 #define NEMA_TRANSITIONS_H__
31 
32 #include "nema_blender.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 typedef enum {
39     NEMA_TRANS_LINEAR_H,
40     NEMA_TRANS_CUBE_H,
41     NEMA_TRANS_INNERCUBE_H,
42     NEMA_TRANS_STACK_H,
43     NEMA_TRANS_LINEAR_V,
44     NEMA_TRANS_CUBE_V,
45     NEMA_TRANS_INNERCUBE_V,
46     NEMA_TRANS_STACK_V,
47     NEMA_TRANS_FADE,
48     NEMA_TRANS_FADE_ZOOM,
49     NEMA_TRANS_MAX,
50     NEMA_TRANS_NONE,
51 } nema_transition_t;
52 
53 /** \brief Transition from 'initial' texture to 'final' texture. The transition is complete when 'step' is 0 or 1
54  *
55  * \param effect Transition effect
56  * \param initial Initial texture
57  * \param final Final texture
58  * \param blending_mode Blending mode
59  * \param step Transition step within [0.f , 1.f] range
60  * \param width Texture width
61  * \param height Texture height
62  *
63  */
64 void nema_transition(nema_transition_t effect, nema_tex_t initial, nema_tex_t final,
65                     uint32_t blending_mode, float step, int width, int height);
66 
67 
68 /** \brief Linear transition horizontally. When 'step' changes from zero to one, textures move from right to left,
69 otherwise textures move from left to right. The transition is complete when 'step' is 0 or 1.
70  *
71  * \param left Texture on the left side
72  * \param right Texture on the right side
73  * \param blending_mode Blending mode
74  * \param step Current step within [0.f , 1.f] range
75  * \param width Texture width
76  *
77  */
78 void nema_transition_linear_hor(nema_tex_t left, nema_tex_t right,
79                                 uint32_t blending_mode, float step, int width);
80 
81 /** \brief Linear transition vertically. When 'step' changes from zero to one, textures move from top to bottom,
82 otherwise textures move from bottom to top. The transition is complete when 'step' is 0 or 1.
83  *
84  * \param up Texture on the top side
85  * \param down Texture on the bottom side
86  * \param blending_mode Blending mode
87  * \param step Current step within [0.f , 1.f] range
88  * \param height Texture height
89  *
90  */
91 void nema_transition_linear_ver(nema_tex_t up, nema_tex_t down,
92                                 uint32_t blending_mode, float step, int height);
93 
94 /** \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,
95 otherwise textures move from right to left. The transition is complete when 'step' is 0 or 1.
96  *
97  * \param left Texture on the left side
98  * \param right Texture on the right side
99  * \param blending_mode Blending mode
100  * \param step Current step within [0.f , 1.f] range
101  * \param width Texture width
102  * \param height Texture height
103  *
104  */
105 void nema_transition_cube_hor(nema_tex_t left, nema_tex_t right,
106                               uint32_t blending_mode, float step, int width, int height);
107 
108 /** \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,
109 otherwise textures move from bottom to top. The transition is complete when 'step' is 0 or 1.
110  *
111  * \param up Texture on the top side
112  * \param down Texture on the bottom side
113  * \param blending_mode Blending mode
114  * \param step Current step within [0.f , 1.f] range
115  * \param width Texture width
116  * \param height Texture height
117  *
118  */
119 void nema_transition_cube_ver(nema_tex_t up, nema_tex_t down,
120                               uint32_t blending_mode, float step, int width, int height);
121 
122 /** \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,
123 otherwise textures move from right to left. The transition is complete when 'step' is 0 or 1.
124  *
125  * \param left Texture on the left side
126  * \param right Texture on the right side
127  * \param blending_mode Blending mode
128  * \param step Current step within [0.f , 1.f] range
129  * \param width Texture width
130  * \param height Texture height
131  *
132  */
133 void nema_transition_innercube_hor(nema_tex_t left, nema_tex_t right,
134                                    uint32_t blending_mode, float step, int width, int height);
135 
136 /** \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,
137 otherwise textures move from bottom to top. The transition The transition is complete when 'step' is 0 or 1.
138  *
139  * \param up Texture on the top side
140  * \param down Texture on the bottom side
141  * \param blending_mode Blending mode
142  * \param step Current step within [0.f , 1.f] range
143  * \param width Texture width
144  * \param height Texture height
145  *
146  */
147 void nema_transition_innercube_ver(nema_tex_t up, nema_tex_t down,
148                                    uint32_t blending_mode, float step, int width, int height);
149 
150 /** \brief Stack transition horizontally. When 'step' changes from zero to one, textures move from left to right,
151 otherwise textures move from right to left. The transition is complete when 'step' is 0 or 1.
152  *
153  * \param up Texture on the top side
154  * \param down Texture on the bottom side
155  * \param blending_mode Blending mode
156  * \param step Current step within [0.f , 1.f] range
157  * \param width Texture width
158  * \param height Texture height
159  *
160  */
161 void nema_transition_stack_hor(nema_tex_t left, nema_tex_t right, float step,
162                                 int width, int height);
163 
164 /** \brief Stack transition vertically. When 'step' moves from zero to one, textures move from top to bottom,
165 otherwise textures move from bottom to top. The transition is complete when 'step' is 0 or 1.
166  *
167  * \param up Texture on the top side
168  * \param down Texture on the bottom side
169  * \param blending_mode Blending mode
170  * \param step Current step within [0.f , 1.f] range
171  * \param width Texture width
172  * \param height Texture height
173  *
174  */
175 void nema_transition_stack_ver(nema_tex_t up, nema_tex_t down, float step,
176                                 int width, int height);
177 
178 /** \brief Fade transition. Initial texture is being faded out, while final texture is being faded in.
179 The transition is complete when 'step' is 0 or 1.
180  *
181  * \param left Texture on the left side
182  * \param right Texture on the right side
183  * \param blending_mode Blending mode
184  * \param step Current step within [0.f , 1.f] range
185  * \param width Texture width
186  * \param height Texture height
187  *
188  */
189 void nema_transition_fade(nema_tex_t initial, nema_tex_t final,
190 						  uint32_t blending_mode, float step, int width, int height);
191 
192 /** \brief Fade-zoom transition. Initial texture is being zoomed and faded out, while final texture is being zoomed and faded in.
193 The transition is complete when 'step' is 0 or 1.
194  *
195  * \param initial Initial texture
196  * \param final Final texture
197  * \param blending_mode Blending mode
198  * \param step Current step within [0.f , 1.f] range
199  * \param width Texture width
200  * \param height Texture height
201  *
202  */
203 void nema_transition_fade_zoom(nema_tex_t initial, nema_tex_t final,
204                                 uint32_t blending_mode, float step, int width, int height);
205 
206 #ifdef __cplusplus
207 }
208 #endif
209 
210 #endif
211