mGEff API Reference  v1.2.0
An animation framework for MiniGUI apps
mgeff-effector.h
Go to the documentation of this file.
1 
41 #ifndef _MGEFF_EFFECTOR_H_
42 #define _MGEFF_EFFECTOR_H_
43 
44 #include <stdint.h>
45 
46 #include <minigui/common.h>
47 #include <minigui/minigui.h>
48 #include <minigui/gdi.h>
49 #include <minigui/window.h>
50 
51 #include "mgeff-common.h"
52 #include "mgeff-animation.h"
53 #include "mgeff-effector-source.h"
54 #include "mgeff-effector-sink.h"
55 
59 MGEFF_DECLARE_HANDLE(MGEFF_EFFECTOR);
60 
77 typedef int (*MGEFF_EFFECTOR_SETPROPERTY)(MGEFF_EFFECTOR effector,
78  int property_id, int value);
79 
91 typedef int (*MGEFF_EFFECTOR_GETPROPERTY)(MGEFF_EFFECTOR effector,
92  int property_id, int* pValue);
93 
107 typedef void (*MGEFF_EFFECTOR_ANIM_ONDRAW)(MGEFF_ANIMATION animation,
108  MGEFF_EFFECTOR effector, HDC sink_dc, intptr_t id, void *value);
109 
121 typedef void (*MGEFF_EFFECTOR_ONBEGINDRAW)(MGEFF_ANIMATION animation,
122  MGEFF_EFFECTOR effector);
123 
133 typedef void (*MGEFF_EFFECTOR_ONENDDRAW)(MGEFF_ANIMATION animation,
134  MGEFF_EFFECTOR effector);
135 
147 typedef MGEFF_EFFECTOR (*MGEFF_EFFECTOR_INIT)(MGEFF_EFFECTOR effector);
148 
158 typedef void (*MGEFF_EFFECTOR_FINALIZE)(MGEFF_EFFECTOR effector);
159 
160 #define EFFECTORNAME_MAX_LEN 31
165 typedef struct _EFFECTOROPS {
166  char name[EFFECTORNAME_MAX_LEN + 1];
167  enum EffVariantType varianttype;
176 
177 
178 #define MGEFF_MINOR_leafwindow "leafwindow"
179 #define MGEFF_MINOR_zip "zip"
180 #define MGEFF_MINOR_flip "flip"
181 #define MGEFF_MINOR_cubicrotate "cubicrotate"
182 #define MGEFF_MINOR_alpha "alphablending"
183 #define MGEFF_MINOR_scroll "scrollpage"
184 #define MGEFF_MINOR_zoom "zoominzoomout"
185 #define MGEFF_MINOR_push "pushpoll"
186 #define MGEFF_MINOR_clear "clear"
187 #define MGEFF_MINOR_centersplit "centersplit"
188 #define MGEFF_MINOR_radarscan "radarscan"
189 #define MGEFF_MINOR_fivepointedstar "fivepointedstar"
190 #define MGEFF_MINOR_roller "roller"
191 #define MGEFF_MINOR_blockflip "blockflip"
192 #define MGEFF_MINOR_es_cubicrotate "opengles-cubicrotate"
193 #define MGEFF_MINOR_es_rectrotate "opengles-rectrotate"
194 #define MGEFF_MINOR_es_coverflow "opengles-coverflow"
195 #define MGEFF_MINOR_mgplus_rotate "mgplus-rotate"
196 #define MGEFF_MINOR_mgplus_cubicrotate "mgplus-cubicrotate"
197 #define MGEFF_MINOR_mgplus_flip "mgplus-flip"
200 #define MGEFF_EFFECTOR_LEAFWINDOW mGEffStr2Key(MGEFF_MINOR_leafwindow)
201 #define MGEFF_EFFECTOR_ZIP mGEffStr2Key(MGEFF_MINOR_zip)
202 #define MGEFF_EFFECTOR_FLIP mGEffStr2Key(MGEFF_MINOR_flip)
203 #define MGEFF_EFFECTOR_CUBIC_ROTATE mGEffStr2Key(MGEFF_MINOR_cubicrotate)
204 #define MGEFF_EFFECTOR_ALPHA mGEffStr2Key(MGEFF_MINOR_alpha)
205 #define MGEFF_EFFECTOR_SCROLL mGEffStr2Key(MGEFF_MINOR_scroll)
206 #define MGEFF_EFFECTOR_ZOOM mGEffStr2Key(MGEFF_MINOR_zoom)
207 #define MGEFF_EFFECTOR_PUSH mGEffStr2Key(MGEFF_MINOR_push)
208 #define MGEFF_EFFECTOR_CLEAR mGEffStr2Key(MGEFF_MINOR_clear)
209 #define MGEFF_EFFECTOR_CENTERSPLIT mGEffStr2Key(MGEFF_MINOR_centersplit)
210 #define MGEFF_EFFECTOR_RADARSCAN mGEffStr2Key(MGEFF_MINOR_radarscan)
211 #define MGEFF_EFFECTOR_FIVEPOINTEDSTAR mGEffStr2Key(MGEFF_MINOR_fivepointedstar)
212 #define MGEFF_EFFECTOR_ROLLER mGEffStr2Key(MGEFF_MINOR_roller)
213 #define MGEFF_EFFECTOR_BLOCKFLIP mGEffStr2Key(MGEFF_MINOR_blockflip)
214 #define MGEFF_EFFECTOR_OPENGL_CUBICROTATE mGEffStr2Key(MGEFF_MINOR_es_cubicrotate)
215 #define MGEFF_EFFECTOR_OPENGL_RECTROTATE mGEffStr2Key(MGEFF_MINOR_es_rectrotate)
216 #define MGEFF_EFFECTOR_OPENGL_COVERFLOW mGEffStr2Key(MGEFF_MINOR_es_coverflow)
217 #define MGEFF_EFFECTOR_MGPLUS_ROTATE mGEffStr2Key(MGEFF_MINOR_mgplus_rotate)
218 #define MGEFF_EFFECTOR_MGPLUS_CUBIC_ROTATE mGEffStr2Key(MGEFF_MINOR_mgplus_cubicrotate)
219 #define MGEFF_EFFECTOR_MGPLUS_FLIP mGEffStr2Key(MGEFF_MINOR_mgplus_flip)
221 /* #define MGEFF_EFFECTOR_MAX 0 */
222 
225 #define MGEFF_PROPERTY_DIRECTION 1
226 #define MGEFF_PROPERTY_AXIS 2
227 #define MGEFF_PROPERTY_LEAFROWS 4
228 #define MGEFF_PROPERTY_LEAFVERTICAL 5
229 #define MGEFF_PROPERTY_ZOOM 6
230 #define MGEFF_PROPERTY_RESOURCE 7
231 #define MGEFF_PROPERTY_BACKGROUND 8
232 #define MGEFF_PROPERTY_PIECES 9
233 #define MGEFF_PROPERTY_STARTANGLE 10
239 enum LeafProperty {
240  MGEFF_DIRECTION_LEFT2RIGHT = 0,
241  MGEFF_DIRECTION_RIGHT2LEFT = 1,
242  MGEFF_DIRECTION_TOP2BOTTOM = 2,
243  MGEFF_DIRECTION_BOTTOM2TOP = 3
244 };
245 
251  MGEFF_DIRECTION_CENTER2OUTSIDE_4 = 0,
252  MGEFF_DIRECTION_OUTSIDE2CENTER_4 = 1,
253  MGEFF_DIRECTION_CENTER2OUTSIDE_2 = 2,
254  MGEFF_DIRECTION_OUTSIDE2CENTER_2 = 3
255 };
256 
262  MGEFF_AXIS_X = 1,
263  MGEFF_AXIS_Y = 2,
264  MGEFF_AXIS_Z = 3
265 };
266 
272  MGEFF_CLOCKWISE = 0,
273  MGEFF_CLOCKINVERSE = 1
274 };
275 
281  MGEFF_DIRECTION_CENTER = 0,
282  MGEFF_DIRECTION_LUP2RDOWN = 1,
283  MGEFF_DIRECTION_LDOWN2RUP = 2,
284  MGEFF_DIRECTION_RDOWN2LUP = 3,
285  MGEFF_DIRECTION_RUP2LDOWN = 4
286 };
287 
295 };
296 
309 MGEFF_EXPORT unsigned long mGEffStr2Key (const char* str);
310 
323 MGEFF_EXPORT MGEFF_EFFECTOR mGEffEffectorCreate(unsigned long key);
324 
336 MGEFF_EXPORT void mGEffEffectorDelete(MGEFF_EFFECTOR handle);
337 
349 MGEFF_EXPORT void mGEffEffectorDeleteWithoutSink(MGEFF_EFFECTOR handle);
350 
351 
367 MGEFF_EXPORT int mGEffEffectorAppendSource(MGEFF_EFFECTOR effector,
368  MGEFF_SOURCE source);
369 
385 MGEFF_EXPORT int mGEffEffectorSetSink(MGEFF_EFFECTOR effector, MGEFF_SINK sink);
386 
399 MGEFF_EXPORT MGEFF_SINK mGEffEffectorGetSink(MGEFF_EFFECTOR effector);
400 
418 MGEFF_EXPORT HDC mGEffEffectorGetSourceDC(MGEFF_EFFECTOR effector, int index);
419 
435 MGEFF_EXPORT int mGEffEffectorSetProperty(MGEFF_EFFECTOR handle,
436  int property_id, int value);
437 
454 MGEFF_EXPORT int mGEffEffectorGetProperty(MGEFF_EFFECTOR handle,
455  int property_id, int *pValue);
456 
470 MGEFF_EXPORT MGEFF_ANIMATION mGEffAnimationCreateWithEffector(MGEFF_EFFECTOR effector);
471 
494 MGEFF_EXPORT int mGEffFillEffectorAnimation(HWND hwnd, HDC src1_dc, HDC src2_dc,
495  HDC dst_dc, unsigned long key, int duration);
496 
516 MGEFF_EXPORT MGEFF_EFFECTOR mGEffEffectorCreateEx(HDC src1_dc, HDC src2_dc,
517  HDC dst_dc, unsigned long key);
518 
536 MGEFF_EXPORT MGEFF_EFFECTOR mGEffEffectorCreateWithoutSink(HDC src1_dc,
537  HDC src2_dc, unsigned long key);
538 
553 
567 
584 MGEFF_EXPORT MGEFF_ANIMATION mGEffCreateRollerAnimation(HDC dc_rollup,
585  HDC dc_expand, HDC dc_dst);
586 
601 MGEFF_EXPORT void mGEffEffectorSetContext(MGEFF_EFFECTOR handle,
602  void *context);
603 
616 MGEFF_EXPORT void *mGEffEffectorGetContext(MGEFF_EFFECTOR handle);
617 
633 MGEFF_EXPORT MGEFF_SOURCE mGEffEffectorGetSource(MGEFF_EFFECTOR handle,
634  int index);
635 
649 
650 #endif
651 
MGEFF_EXPORT unsigned long mGEffStr2Key(const char *str)
Generate hash key of string.
Definition: mgeff-effector.h:294
MGEFF_EXPORT int mGEffFillEffectorAnimation(HWND hwnd, HDC src1_dc, HDC src2_dc, HDC dst_dc, unsigned long key, int duration)
Fills a DC with a predefined effector.
Effecr sink headfile.
RotateDirectionProperty
RotateDirectionProperty.
Definition: mgeff-effector.h:271
MGEFF_EXPORT int mGEffEffectorSetSink(MGEFF_EFFECTOR effector, MGEFF_SINK sink)
Sets the sink of a effector.
Definition: mgeff-effector.h:293
void(* MGEFF_EFFECTOR_ONENDDRAW)(MGEFF_ANIMATION animation, MGEFF_EFFECTOR effector)
Type of effector end draw callback function.
Definition: mgeff-effector.h:133
MGEFF_EXPORT MGEFF_EFFECTOR mGEffEffectorCreate(unsigned long key)
Creates a effector.
MGEFF_EXPORT MGEFF_BOOL mGEffEffectorRegister(const MGEFF_EFFECTOROPS *info)
Register specail effector info.
MGEFF_EXPORT void mGEffEffectorDeleteWithoutSink(MGEFF_EFFECTOR handle)
Deletes a effector.
MGEFF_EXPORT MGEFF_SINK mGEffEffectorGetSink(MGEFF_EFFECTOR effector)
Gets the sink of a effector.
void(* MGEFF_EFFECTOR_FINALIZE)(MGEFF_EFFECTOR effector)
Type of effector finalize callback function.
Definition: mgeff-effector.h:158
A motion curve headfile.
MGEFF_EXPORT int mGEffEffectorSetProperty(MGEFF_EFFECTOR handle, int property_id, int value)
Sets the property of a effector.
struct _EFFECTOROPS MGEFF_EFFECTOROPS
it contains whole info of an effector, if you want to custom an effector, implement it ...
MGEFF_DECLARE_HANDLE(MGEFF_EFFECTOR)
The handle to the effector.
MGEFF_EFFECTOR_ONENDDRAW enddraw
Definition: mgeff-effector.h:172
MGEFF_EXPORT MGEFF_EFFECTOROPS * mGEffEffectorGetOps(unsigned long key)
Gets the effector MGEFF_EFFECTOROPS ops.
ZoomTypeProperty
ZoomTypeProperty.
Definition: mgeff-effector.h:292
void(* MGEFF_EFFECTOR_ANIM_ONDRAW)(MGEFF_ANIMATION animation, MGEFF_EFFECTOR effector, HDC sink_dc, intptr_t id, void *value)
Type of effector on draw callback function.
Definition: mgeff-effector.h:107
MGEFF_EXPORT void * mGEffEffectorGetContext(MGEFF_EFFECTOR handle)
Gets the effector context.
MGEFF_EXPORT MGEFF_ANIMATION mGEffAnimationCreateWithEffector(MGEFF_EFFECTOR effector)
Creates a animation with a effector.
MGEFF_EFFECTOR_FINALIZE finalize
Definition: mgeff-effector.h:169
MGEFF_EFFECTOR_GETPROPERTY getproperty
Definition: mgeff-effector.h:174
Effector source headfile.
MGEFF_EXPORT MGEFF_EFFECTOR mGEffEffectorCreateEx(HDC src1_dc, HDC src2_dc, HDC dst_dc, unsigned long key)
Creates a effector of certain type with given source DCs and destination DC.
MGEFF_EXPORT MGEFF_EFFECTOR mGEffEffectorCreateWithoutSink(HDC src1_dc, HDC src2_dc, unsigned long key)
Creates a effector of certain type with given source DCs but WITHOUT a destination DC...
MGEFF_EXPORT int mGEffEffectorGetProperty(MGEFF_EFFECTOR handle, int property_id, int *pValue)
Sets the property of a effector.
#define MGEFF_EXPORT
Definition: mgeff-common.h:52
MGEFF_EFFECTOR_ONBEGINDRAW begindraw
Definition: mgeff-effector.h:171
MGEFF_EFFECTOR_ANIM_ONDRAW ondraw
Definition: mgeff-effector.h:170
MGEFF_EXPORT MGEFF_BOOL mGEffEffectorUnRegister(const MGEFF_EFFECTOROPS *info)
UnRegister specail effector info.
MGEFF_EFFECTOR(* MGEFF_EFFECTOR_INIT)(MGEFF_EFFECTOR effector)
Type of effector init callback function.
Definition: mgeff-effector.h:147
MGEFF_EFFECTOR_INIT init
Definition: mgeff-effector.h:168
MGEFF_EXPORT HDC mGEffEffectorGetSourceDC(MGEFF_EFFECTOR effector, int index)
Gets the underlying DC of the source of a effector.
int MGEFF_BOOL
type of MGEFF_BOOL
Definition: mgeff-common.h:67
AxisProperty
AxisProperty.
Definition: mgeff-effector.h:261
MGEFF_EXPORT void mGEffEffectorSetContext(MGEFF_EFFECTOR handle, void *context)
Sets the effector context.
MGEFF_EFFECTOR_SETPROPERTY setproperty
Definition: mgeff-effector.h:173
EffVariantType
animation variant
Definition: mgeff-animation.h:98
MGEFF_EXPORT MGEFF_SOURCE mGEffEffectorGetSource(MGEFF_EFFECTOR handle, int index)
Gets the effector source.
CenterSplitProperty
CenterSplitProperty.
Definition: mgeff-effector.h:250
ZoomProperty
ZoomProperty.
Definition: mgeff-effector.h:280
common macro and type define.
MGEFF_EXPORT void mGEffEffectorDelete(MGEFF_EFFECTOR handle)
Deletes a effector.
#define EFFECTORNAME_MAX_LEN
Definition: mgeff-effector.h:160
MGEFF_EXPORT int mGEffEffectorAppendSource(MGEFF_EFFECTOR effector, MGEFF_SOURCE source)
Appends a source to effector.
int(* MGEFF_EFFECTOR_GETPROPERTY)(MGEFF_EFFECTOR effector, int property_id, int *pValue)
Type of effector get property callback functio.
Definition: mgeff-effector.h:91
void(* MGEFF_EFFECTOR_ONBEGINDRAW)(MGEFF_ANIMATION animation, MGEFF_EFFECTOR effector)
Type of effector begin draw callback function.
Definition: mgeff-effector.h:121
MGEFF_EXPORT MGEFF_ANIMATION mGEffCreateRollerAnimation(HDC dc_rollup, HDC dc_expand, HDC dc_dst)
create a roller animation from specail dc.
int(* MGEFF_EFFECTOR_SETPROPERTY)(MGEFF_EFFECTOR effector, int property_id, int value)
effector callback
Definition: mgeff-effector.h:77
it contains whole info of an effector, if you want to custom an effector, implement it ...
Definition: mgeff-effector.h:165