mGNCS API Reference  v1.5.0
A new control set and a new framework for MiniGUI apps
manimatepiece.h
1 //
3 // IMPORTANT NOTICE
4 //
5 // The following open source license statement does not apply to any
6 // entity in the Exception List published by FMSoft.
7 //
8 // For more information, please visit:
9 //
10 // https://www.fmsoft.cn/exception-list
11 //
13 /*
14  * This file is part of mGNCS, a component for MiniGUI.
15  *
16  * Copyright (C) 2008~2018, Beijing FMSoft Technologies Co., Ltd.
17  *
18  * This program is free software: you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation, either version 3 of the License, or
21  * (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program. If not, see <http://www.gnu.org/licenses/>.
30  *
31  * Or,
32  *
33  * As this program is a library, any link to this program must follow
34  * GNU General Public License version 3 (GPLv3). If you cannot accept
35  * GPLv3, you need to be licensed from FMSoft.
36  *
37  * If you have got a commercial license of this program, please use it
38  * under the terms and conditions of the commercial license.
39  *
40  * For more information about the commercial license, please refer to
41  * <http://www.minigui.com/blog/minigui-licensing-policy/>.
42  */
43 #ifdef _MGNCSCTRL_ANIMATE
44 #ifndef _MGNCS_ANIMATEPIECE_H
45 #define _MGNCS_ANIMATEPIECE_H
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 typedef struct _mAnimatePiece mAnimatePiece;
52 typedef struct _mAnimatePieceClass mAnimatePieceClass;
53 
54 #define mAnimatePieceHeader(clss) \
55  mStaticPieceHeader(clss) \
56  unsigned char flags; \
57  unsigned char align:4; \
58  unsigned char valign:4; \
59  mAnimateFrames *frame;
60 
61 struct _mAnimatePiece
62 {
63  mAnimatePieceHeader(mAnimatePiece)
64 };
65 
66 #define mAnimatePieceClassHeader(clss, superCls) \
67  mStaticPieceClassHeader(clss, superCls) \
68  void (*reset)(mAnimatePiece *self); \
69  void (*autofit)(mAnimatePiece *self, int *width, int *height); \
70 
71 struct _mAnimatePieceClass
72 {
73  mAnimatePieceClassHeader(mAnimatePiece, mStaticPiece)
74 };
75 
76 MGNCS_EXPORT extern mAnimatePieceClass g_stmAnimatePieceCls;
77 
78 enum mAnimatePieceProps {
79  NCSP_ANIMATEPIECE_GIFFILE = ANIMATEPIECE_PROP_BEGIN,
80  NCSP_ANIMATEPIECE_DIR,
81  NCSP_ANIMATEPIECE_MEM,
82  NCSP_ANIMATEPIECE_AUTOLOOP,
83  NCSP_ANIMATEPIECE_SCALE,
84  NCSP_ANIMATEPIECE_AUTOFIT,
85  NCSP_ANIMATEPIECE_AUTOPLAY,
86  NCSP_ANIMATEPIECE_BMPARRAY,
87  NCSP_ANIMATEPIECE_AFRAME,
88  NCSP_ANIMATEPIECE_ALIGN = PIECECOMM_PROP_ALIGN,
89  NCSP_ANIMATEPIECE_VALIGN = PIECECOMM_PROP_VALIGN
90 };
91 
92 #define NCSS_AF_AUTOLOOP 0x01
93 #define NCSS_AF_PLAY 0x02
94 #define NCSS_AF_SCALE 0x04
95 #define NCSS_AF_AUTOFIT 0x08
96 #define NCSS_AF_AUTOPLAY 0x10
97 
98 #define mAnimatePiece_setAutoloop(self, bautoloop) \
99  ((bautoloop)?SET_BIT((self)->flags, NCSS_AF_AUTOLOOP):CLEAR_BIT((self)->flags, NCSS_AF_AUTOLOOP))
100 
101 #define mAnimatePiece_isAutoloop(self) \
102  IS_BIT_SET((self)->flags, NCSS_AF_AUTOLOOP)
103 
104 #define mAnimatePiece_setScale(self, bscale) \
105  ((bscale)?SET_BIT((self)->flags, NCSS_AF_SCALE):CLEAR_BIT((self)->flags, NCSS_AF_SCALE))
106 
107 #define mAnimatePiece_isScale(self) \
108  IS_BIT_SET((self)->flags, NCSS_AF_SCALE)
109 
110 #define mAnimatePiece_setAutofit(self, bautofit) \
111  ((bautofit)?SET_BIT((self)->flags, NCSS_AF_AUTOFIT):CLEAR_BIT((self)->flags, NCSS_AF_AUTOFIT))
112 
113 #define mAnimatePiece_isAutofit(self) \
114  IS_BIT_SET((self)->flags, NCSS_AF_AUTOFIT)
115 
116 #define mAnimatePiece_setPlay(self, bplay) \
117  ((bplay)?SET_BIT((self)->flags, NCSS_AF_PLAY):CLEAR_BIT((self)->flags, NCSS_AF_PLAY))
118 
119 #define mAnimatePiece_isPlay(self) \
120  IS_BIT_SET((self)->flags, NCSS_AF_PLAY)
121 
122 #define mAnimatePiece_setAutoplay(self, bautoplay) \
123  ((bautoplay)?SET_BIT((self)->flags, NCSS_AF_AUTOPLAY):CLEAR_BIT((self)->flags, NCSS_AF_AUTOPLAY))
124 
125 #define mAnimatePiece_isAutoplay(self) \
126  IS_BIT_SET((self)->flags, NCSS_AF_AUTOPLAY)
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif
133 #endif //_MGNCSCTRL_ANIMATE
134