1 /*
2   Ming, an SWF output library
3 
4   Copyright (C) 2004-2011 Sandro Santilli <strk@keybit.net>
5   Copyright (C) 2006-2013 Stuart R. Anderson <anderson@netsweng.com>
6   Copyright (C) 2004-2008 Klaus Rechert <klaus@rechert.de>
7   Copyright (C) 2008      Frank M. Kromann <fmk@php.net>
8   Copyright (C) 2001-2002 Dave Hayden <dave@opaque.net>
9 
10   This library is free software; you can redistribute it and/or
11   modify it under the terms of the GNU Lesser General Public
12   License as published by the Free Software Foundation; either
13   version 2.1 of the License, or (at your option) any later version.
14 
15   This library is distributed in the hope that it will be useful,
16   but WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18   Lesser General Public License for more details.
19 
20   You should have received a copy of the GNU Lesser General Public
21   License along with this library; if not, write to the Free Software
22   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 
24 */
25 
26 #ifndef _PHP_MING_H
27 #define _PHP_MING_H
28 
29 #if !defined(PHP_METHOD)
30 /* Must be building for PHP4 */
31 #define ZEND_METHOD(classname, name)    ZEND_NAMED_FUNCTION(ZEND_FN(classname##_##name))
32 #define PHP_METHOD              ZEND_METHOD
33 
34 #define ZEND_ME(classname, name, arg_info, flags)       ZEND_FALIAS(name, classname##_##name, arg_info)
35 #define PHP_ME                  ZEND_ME
36 
37 
38 #undef INIT_CLASS_ENTRY
39 #define INIT_CLASS_ENTRY(class_container, class_name, functions)	\
40 	{								\
41 		char *p;						\
42 		php4_fix_funcnames(class_name,functions);		\
43 		class_container.name = strdup(class_name);		\
44 		p = class_container.name;while(*p) {*p = tolower(*p);p++;}  \
45 		class_container.name_length = sizeof(class_name) - 1;	\
46 		class_container.builtin_functions = functions;		\
47 		class_container.handle_function_call = NULL;		\
48 		class_container.handle_property_get = NULL;		\
49 		class_container.handle_property_set = NULL;		\
50 	}
51 #endif
52 
53 #if HAVE_MING
54 
55 extern zend_module_entry ming_module_entry;
56 #define ming_module_ptr &ming_module_entry
57 
58 PHP_RINIT_FUNCTION(ming);
59 PHP_MINIT_FUNCTION(ming);
60 PHP_MINFO_FUNCTION(ming);
61 
62 PHP_METHOD(swfbitmap, init);
63 PHP_METHOD(swfbitmap, getWidth);
64 PHP_METHOD(swfbitmap, getHeight);
65 
66 PHP_METHOD(swfvideostream, init);
67 PHP_METHOD(swfvideostream, setdimention);
68 PHP_METHOD(swfvideostream, getnumframes);
69 PHP_METHOD(swfvideostream, hasaudio);
70 PHP_METHOD(swfvideostream, setFrameMode);
71 PHP_METHOD(swfvideostream, nextFrame);
72 PHP_METHOD(swfvideostream, seek);
73 
74 PHP_METHOD(swfprebuiltclip, init);
75 
76 PHP_METHOD(swfbinarydata, init);
77 
78 PHP_METHOD(swfshadow, init);
79 
80 PHP_METHOD(swfblur, init);
81 
82 PHP_METHOD(swffiltermatrix, init);
83 
84 PHP_METHOD(swffilter, init);
85 
86 PHP_METHOD(swfbrowserfont, init);
87 
88 PHP_METHOD(swfinput, init);
89 
90 PHP_METHOD(swfcxform, init);
91 PHP_METHOD(swfcxform, setColorAdd);
92 PHP_METHOD(swfcxform, setColorMult);
93 
94 PHP_METHOD(swffill, init);
95 PHP_METHOD(swffill, moveTo);
96 PHP_METHOD(swffill, move);
97 PHP_METHOD(swffill, scaleTo);
98 PHP_METHOD(swffill, scale);
99 PHP_METHOD(swffill, rotateTo);
100 PHP_METHOD(swffill, rotate);
101 PHP_METHOD(swffill, skewXTo);
102 PHP_METHOD(swffill, skewX);
103 PHP_METHOD(swffill, skewYTo);
104 PHP_METHOD(swffill, skewY);
105 
106 PHP_METHOD(swfgradient, init);
107 PHP_METHOD(swfgradient, addEntry);
108 
109 PHP_METHOD(swfshape, init);
110 PHP_METHOD(swfshape, addfill);
111 PHP_METHOD(swfshape, setrightfill);
112 PHP_METHOD(swfshape, setleftfill);
113 PHP_METHOD(swfshape, setline);
114 PHP_METHOD(swfshape, movepento);
115 PHP_METHOD(swfshape, movepen);
116 PHP_METHOD(swfshape, drawlineto);
117 PHP_METHOD(swfshape, drawline);
118 PHP_METHOD(swfshape, drawcurveto);
119 PHP_METHOD(swfshape, drawcurve);
120 PHP_METHOD(swfshape, drawglyph);
121 PHP_METHOD(swfshape, drawarc);
122 PHP_METHOD(swfshape, drawcircle);
123 PHP_METHOD(swfshape, drawcubic);
124 PHP_METHOD(swfshape, drawcubicto);
125 PHP_METHOD(swfshape, end);
126 PHP_METHOD(swfshape, useVersion);
127 PHP_METHOD(swfshape, getVersion);
128 PHP_METHOD(swfshape, setRenderHintingFlags);
129 PHP_METHOD(swfshape, getPenX);
130 PHP_METHOD(swfshape, getPenY);
131 PHP_METHOD(swfshape, hideLine);
132 PHP_METHOD(swfshape, drawCharacterBounds);
133 PHP_METHOD(swfshape, setLine2);
134 PHP_METHOD(swfshape, setLine2Filled);
135 PHP_METHOD(swfshape, dumpOutline);
136 
137 /* SWFMovie */
138 
139 PHP_METHOD(swfmovie, init);
140 PHP_METHOD(swfmovie, output);
141 PHP_METHOD(swfmovie, saveToFile);
142 PHP_METHOD(swfmovie, save);
143 PHP_METHOD(swfmovie, add);
144 PHP_METHOD(swfmovie, remove);
145 PHP_METHOD(swfmovie, nextFrame);
146 PHP_METHOD(swfmovie, labelFrame);
147 PHP_METHOD(swfmovie, namedAnchor);
148 PHP_METHOD(swfmovie, setBackground);
149 PHP_METHOD(swfmovie, setRate);
150 PHP_METHOD(swfmovie, setDimension);
151 PHP_METHOD(swfmovie, setFrames);
152 
153 #ifdef HAVE_NEW_MING
154 PHP_METHOD(swfmovie, protect);
155 PHP_METHOD(swfmovie, streamMp3);
156 PHP_METHOD(swfmovie, addExport);
157 PHP_METHOD(swfmovie, writeExports);
158 PHP_METHOD(swfmovie, startSound);
159 PHP_METHOD(swfmovie, stopSound);
160 PHP_METHOD(swfmovie, importChar);
161 PHP_METHOD(swfmovie, importFont);
162 PHP_METHOD(swfmovie, addFont);
163 PHP_METHOD(swfmovie, replace);
164 PHP_METHOD(swfmovie, getRate);
165 # endif
166 
167 /* SWFSprint */
168 
169 PHP_METHOD(swfsprite, init);
170 PHP_METHOD(swfsprite, add);
171 PHP_METHOD(swfsprite, remove);
172 PHP_METHOD(swfsprite, nextFrame);
173 PHP_METHOD(swfsprite, labelFrame);
174 PHP_METHOD(swfsprite, setFrames);
175 
176 #ifdef HAVE_NEW_MING
177 PHP_METHOD(swfsprite, startSound);
178 PHP_METHOD(swfsprite, stopSound);
179 #endif
180 
181 /* SWFFont */
182 
183 PHP_METHOD(swffont, init);
184 PHP_METHOD(swffont, getWidth);
185 PHP_METHOD(swffont, getAscent);
186 PHP_METHOD(swffont, getDescent);
187 PHP_METHOD(swffont, getLeading);
188 #ifdef HAVE_NEW_MING
189 PHP_METHOD(swffont, getUTF8Width);
190 PHP_METHOD(swffont, getGlyphCount);
191 PHP_METHOD(swffont, getName);
192 #endif
193 PHP_METHOD(swffont, getShape);
194 
195 /* SWFFontCollection */
196 
197 PHP_METHOD(swffontcollection, init);
198 PHP_METHOD(swffontcollection, getFont);
199 PHP_METHOD(swffontcollection, getFontCount);
200 
201 
202 /* SWFText */
203 
204 PHP_METHOD(swftext, init);
205 PHP_METHOD(swftext, setFont);
206 PHP_METHOD(swftext, setHeight);
207 PHP_METHOD(swftext, setSpacing);
208 PHP_METHOD(swftext, setColor);
209 PHP_METHOD(swftext, moveTo);
210 PHP_METHOD(swftext, addString);
211 
212 #ifdef HAVE_NEW_MING
213 PHP_METHOD(swftext, addUTF8String);
214 /*PHP_METHOD(swftext, addWideString);*/
215 #endif
216 
217 PHP_METHOD(swftext, getWidth);
218 
219 #ifdef HAVE_NEW_MING
220 PHP_METHOD(swftext, getUTF8Width);
221 /*PHP_METHOD(swftext, getWideWidth);*/
222 #endif
223 
224 PHP_METHOD(swftext, getAscent);
225 PHP_METHOD(swftext, getDescent);
226 PHP_METHOD(swftext, getLeading);
227 
228 /* SWFTextField */
229 
230 PHP_METHOD(swftextfield, init);
231 PHP_METHOD(swftextfield, setFont);
232 PHP_METHOD(swftextfield, setBounds);
233 PHP_METHOD(swftextfield, align);
234 PHP_METHOD(swftextfield, setHeight);
235 PHP_METHOD(swftextfield, setLeftMargin);
236 PHP_METHOD(swftextfield, setRightMargin);
237 PHP_METHOD(swftextfield, setMargins);
238 PHP_METHOD(swftextfield, setIndentation);
239 PHP_METHOD(swftextfield, setLineSpacing);
240 PHP_METHOD(swftextfield, setColor);
241 PHP_METHOD(swftextfield, setName);
242 PHP_METHOD(swftextfield, addString);
243 PHP_METHOD(swftextfield, addUTF8String);
244 PHP_METHOD(swftextfield, setPadding);
245 PHP_METHOD(swftextfield, addChars);
246 PHP_METHOD(swftextfield, setLength);
247 PHP_METHOD(swftextfield, setFieldHeight);
248 
249 /* SWFFontChar */
250 
251 PHP_METHOD(swffontchar, addChars);
252 PHP_METHOD(swffontchar, addUTF8Chars);
253 
254 /* SWFDisplayItem */
255 
256 PHP_METHOD(swfdisplayitem, move);
257 PHP_METHOD(swfdisplayitem, moveTo);
258 PHP_METHOD(swfdisplayitem, scale);
259 PHP_METHOD(swfdisplayitem, scaleTo);
260 PHP_METHOD(swfdisplayitem, rotate);
261 PHP_METHOD(swfdisplayitem, rotateTo);
262 PHP_METHOD(swfdisplayitem, skewX);
263 PHP_METHOD(swfdisplayitem, skewXTo);
264 PHP_METHOD(swfdisplayitem, skewY);
265 PHP_METHOD(swfdisplayitem, skewYTo);
266 PHP_METHOD(swfdisplayitem, setMatrix);
267 PHP_METHOD(swfdisplayitem, setDepth);
268 PHP_METHOD(swfdisplayitem, setRatio);
269 PHP_METHOD(swfdisplayitem, addColor);
270 PHP_METHOD(swfdisplayitem, multColor);
271 PHP_METHOD(swfdisplayitem, setName);
272 PHP_METHOD(swfdisplayitem, addAction);
273 
274 #ifdef HAVE_NEW_MING
275 PHP_METHOD(swfdisplayitem, addFilter);
276 PHP_METHOD(swfdisplayitem, flush);
277 PHP_METHOD(swfdisplayitem, remove);
278 PHP_METHOD(swfdisplayitem, setMaskLevel);
279 PHP_METHOD(swfdisplayitem, endMask);
280 PHP_METHOD(swfdisplayitem, getX);
281 PHP_METHOD(swfdisplayitem, getY);
282 PHP_METHOD(swfdisplayitem, getXScale);
283 PHP_METHOD(swfdisplayitem, getYScale);
284 PHP_METHOD(swfdisplayitem, getXSkew);
285 PHP_METHOD(swfdisplayitem, getYSkew);
286 PHP_METHOD(swfdisplayitem, getRot);
287 PHP_METHOD(swfdisplayitem, getDepth);
288 #endif
289 
290 /* SWFButton */
291 
292 PHP_METHOD(swfbutton, init);
293 PHP_METHOD(swfbutton, setHit);
294 PHP_METHOD(swfbutton, setOver);
295 PHP_METHOD(swfbutton, setUp);
296 PHP_METHOD(swfbutton, setDown);
297 PHP_METHOD(swfbutton, setAction);
298 PHP_METHOD(swfbutton, addShape);
299 
300 #ifdef HAVE_NEW_MING
301 PHP_METHOD(swfbutton, setMenu);
302 #endif
303 
304 PHP_METHOD(swfbutton, addAction);
305 
306 #ifdef HAVE_NEW_MING
307 PHP_METHOD(swfbutton, addSound);
308 PHP_METHOD(swfbutton, addCharacter);
309 #endif
310 
311 /* SWFButtonRecord */
312 
313 PHP_METHOD(swfbuttonrecord, setDepth);
314 PHP_METHOD(swfbuttonrecord, setBlendMode);
315 PHP_METHOD(swfbuttonrecord, move);
316 PHP_METHOD(swfbuttonrecord, moveTo);
317 PHP_METHOD(swfbuttonrecord, rotate);
318 PHP_METHOD(swfbuttonrecord, rotateTo);
319 PHP_METHOD(swfbuttonrecord, scale);
320 PHP_METHOD(swfbuttonrecord, scaleTo);
321 PHP_METHOD(swfbuttonrecord, skewX);
322 PHP_METHOD(swfbuttonrecord, skewXTo);
323 PHP_METHOD(swfbuttonrecord, skewY);
324 PHP_METHOD(swfbuttonrecord, skewYTo);
325 PHP_METHOD(swfbuttonrecord, addFilter);
326 
327 /* SWFAction */
328 
329 PHP_METHOD(swfaction, init);
330 PHP_METHOD(swfaction, compile);
331 
332 /* SWFInitAction */
333 
334 PHP_METHOD(swfinitaction, init);
335 
336 /* SWFMorph */
337 
338 PHP_METHOD(swfmorph, init);
339 PHP_METHOD(swfmorph, getShape1);
340 PHP_METHOD(swfmorph, getShape2);
341 
342 /* SWFSound */
343 
344 PHP_METHOD(swfsound, init);
345 
346 /* SWFSoundInstance */
347 
348 #ifdef HAVE_NEW_MING
349 PHP_METHOD(swfsoundinstance, noMultiple);
350 PHP_METHOD(swfsoundinstance, loopInPoint);
351 PHP_METHOD(swfsoundinstance, loopOutPoint);
352 PHP_METHOD(swfsoundinstance, loopCount);
353 #endif
354 
355 /* SWF Utils */
356 
357 PHP_FUNCTION(ming_keypress);
358 PHP_FUNCTION(ming_setCubicThreshold);
359 PHP_FUNCTION(ming_setScale);
360 PHP_FUNCTION(ming_useSWFVersion);
361 
362 #ifdef HAVE_NEW_MING
363 PHP_FUNCTION(ming_useConstants);
364 PHP_FUNCTION(ming_setSWFCompression);
365 #endif
366 
367 #else
368 #define ming_module_ptr NULL
369 #endif /* HAVE_MING */
370 #define phpext_ming_ptr ming_module_ptr
371 #endif  /* _PHP_MING_H */
372