+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| Authors: Dave Hayden <dave@opaque.net> |
| Frank M. Kromann <fmk@php.net> |
| Stuart R. Anderson <anderson@netsweng.com> |
+ | Klaus Rechert <klaus@rechert.de> |
+----------------------------------------------------------------------+
*/
#include <math.h>
#include <ming.h>
-#define FLOAT_Z_DVAL_PP(x) ((float)Z_DVAL_PP(x))
-#define BYTE_Z_LVAL_PP(x) ((byte)Z_LVAL_PP(x))
-
#ifndef HAVE_DESTROY_SWF_BLOCK
void destroySWFBlock(SWFBlock block);
#endif
PHP_FALIAS(ming_keypress, ming_keypress, NULL)
#ifdef HAVE_NEW_MING
PHP_FALIAS(ming_useconstants, ming_useConstants, NULL)
-#endif
-#ifdef HAVE_MING_SETSWFCOMPRESSION
PHP_FALIAS(ming_setswfcompression, ming_setSWFCompression, NULL)
#endif
{ NULL, NULL, NULL }
static SWFDisplayItem getDisplayItem(zval *id TSRMLS_DC);
static SWFButton getButton(zval *id TSRMLS_DC);
static SWFAction getAction(zval *id TSRMLS_DC);
+static SWFInitAction getInitAction(zval *id TSRMLS_DC);
static SWFMorph getMorph(zval *id TSRMLS_DC);
static SWFMovieClip getSprite(zval *id TSRMLS_DC);
static SWFSound getSound(zval *id TSRMLS_DC);
+static SWFInput getInput(zval *id TSRMLS_DC);
#ifdef HAVE_NEW_MING
static SWFFontCharacter getFontCharacter(zval *id TSRMLS_DC);
static SWFSoundInstance getSoundInstance(zval *id TSRMLS_DC);
static SWFVideoStream getVideoStream(zval *id TSRMLS_DC);
-#endif
-#ifdef HAVE_SWFPREBUILTCLIP
+static SWFButtonRecord getButtonRecord(zval *id TSRMLS_DC);
static SWFPrebuiltClip getPrebuiltClip(zval *id TSRMLS_DC);
+static SWFCharacter getCharacterClass(zval *id TSRMLS_DC);
+static SWFBinaryData getBinaryData(zval *id TSRMLS_DC);
+static SWFBlur getBlur(zval *id TSRMLS_DC);
+static SWFShadow getShadow(zval *id TSRMLS_DC);
+static SWFFilterMatrix getFilterMatrix(zval *id TSRMLS_DC);
+static SWFFilter getFilter(zval *id TSRMLS_DC);
+static SWFCXform getCXform(zval *id TSRMLS_DC);
+static SWFMatrix getMatrix(zval *id TSRMLS_DC);
#endif
#define PHP_MING_FILE_CHK(file) \
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
return;
}
-
Ming_setCubicThreshold(num);
}
/* }}} */
{
double num;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
-
Ming_setScale((float)num);
}
/* }}} */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
return;
}
-
Ming_useSWFVersion(num);
}
/* }}} */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
return;
}
-
Ming_useConstants(num);
}
/* }}} */
-#endif
-#ifdef HAVE_MING_SETSWFCOMPRESSION
/* {{{ set output compression */
PHP_FUNCTION(ming_setSWFCompression)
{
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
return;
}
-
Ming_setSWFCompression(num);
}
/* }}} */
+
#endif
static int le_swfmoviep;
static int le_swfbuttonp;
static int le_swfactionp;
static int le_swfmorphp;
+static int le_swfmovieclipp;
static int le_swfspritep;
static int le_swfinputp;
static int le_swfsoundp;
static int le_swffontcharp;
static int le_swfsoundinstancep;
static int le_swfvideostreamp;
-#endif
-#ifdef HAVE_SWFPREBUILTCLIP
+static int le_swfbuttonrecordp;
+static int le_swfbinarydatap;
+static int le_swfinitactionp;
static int le_swfprebuiltclipp;
+static int le_swfsoundstreamp;
+static int le_swffilterp;
+static int le_swfblurp;
+static int le_swfshadowp;
+static int le_swffiltermatrixp;
+static int le_swfcxformp;
+static int le_swfmatrixp;
+static int le_swfbrowserfontp;
+static int le_swffontcollectionp;
#endif
+static int le_swfcharacterp;
static zend_class_entry *movie_class_entry_ptr;
static zend_class_entry *shape_class_entry_ptr;
static zend_class_entry *button_class_entry_ptr;
static zend_class_entry *action_class_entry_ptr;
static zend_class_entry *morph_class_entry_ptr;
+static zend_class_entry *movieclip_class_entry_ptr;
static zend_class_entry *sprite_class_entry_ptr;
static zend_class_entry *sound_class_entry_ptr;
+static zend_class_entry *character_class_entry_ptr;
+static zend_class_entry *input_class_entry_ptr;
#ifdef HAVE_NEW_MING
static zend_class_entry *fontchar_class_entry_ptr;
static zend_class_entry *soundinstance_class_entry_ptr;
static zend_class_entry *videostream_class_entry_ptr;
-#endif
-#ifdef HAVE_SWFPREBUILTCLIP
+static zend_class_entry *buttonrecord_class_entry_ptr;
+static zend_class_entry *binarydata_class_entry_ptr;
+static zend_class_entry *initaction_class_entry_ptr;
static zend_class_entry *prebuiltclip_class_entry_ptr;
+static zend_class_entry *soundstream_class_entry_ptr;
+static zend_class_entry *filter_class_entry_ptr;
+static zend_class_entry *blur_class_entry_ptr;
+static zend_class_entry *shadow_class_entry_ptr;
+static zend_class_entry *filtermatrix_class_entry_ptr;
+static zend_class_entry *cxform_class_entry_ptr;
+static zend_class_entry *matrix_class_entry_ptr;
+static zend_class_entry *browserfont_class_entry_ptr;
+static zend_class_entry *fontcollection_class_entry_ptr;
#endif
-
+static zend_class_entry *character_class_entry_ptr;
+
/* {{{ internal function SWFgetProperty
*/
static void *SWFgetProperty(zval *id, char *name, int namelen, int proptype TSRMLS_DC)
}
/* }}} */
-/* {{{ SWFCharacter - not a real class
+/* {{{ SWFCharacter
*/
/* {{{ internal function SWFCharacter getCharacter(zval *id)
return (SWFCharacter)getButton(id TSRMLS_CC);
else if (Z_OBJCE_P(id) == morph_class_entry_ptr)
return (SWFCharacter)getMorph(id TSRMLS_CC);
+ else if (Z_OBJCE_P(id) == movieclip_class_entry_ptr)
+ return (SWFCharacter)getSprite(id TSRMLS_CC);
else if (Z_OBJCE_P(id) == sprite_class_entry_ptr)
return (SWFCharacter)getSprite(id TSRMLS_CC);
else if (Z_OBJCE_P(id) == bitmap_class_entry_ptr)
else if(Z_OBJCE_P(id) == sound_class_entry_ptr)
return (SWFCharacter)getSound(id TSRMLS_CC);
#ifdef HAVE_NEW_MING
-
else if(Z_OBJCE_P(id) == fontchar_class_entry_ptr)
return (SWFCharacter)getFontCharacter(id TSRMLS_CC);
else if(Z_OBJCE_P(id) == soundinstance_class_entry_ptr)
return (SWFCharacter)getSoundInstance(id TSRMLS_CC);
-
else if(Z_OBJCE_P(id) == videostream_class_entry_ptr)
return (SWFCharacter)getVideoStream(id TSRMLS_CC);
-#endif
-#ifdef HAVE_SWFPREBUILTCLIP
+ else if(Z_OBJCE_P(id) == buttonrecord_class_entry_ptr)
+ return (SWFCharacter)getButtonRecord(id TSRMLS_CC);
else if(Z_OBJCE_P(id) == prebuiltclip_class_entry_ptr)
return (SWFCharacter)getPrebuiltClip(id TSRMLS_CC);
#endif
else
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFCharacter");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFCharacter");
return NULL;
}
/* }}} */
+
+static SWFCharacter getCharacterClass(zval *id TSRMLS_DC)
+{
+ void *character = SWFgetProperty(id, "character", strlen("character"), le_swfcharacterp TSRMLS_CC);
+
+ if (!character) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFCharacter");
+ }
+ return (SWFCharacter)character;
+}
+
+/* {{{ proto swfcharacter::getWidth() */
+PHP_METHOD(swfcharacter, getWidth)
+{
+ RETURN_DOUBLE(SWFCharacter_getWidth(getCharacter(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+/* {{{ proto swfcharacter::getHeight() */
+PHP_METHOD(swfcharacter, getHeight)
+{
+ RETURN_DOUBLE(SWFCharacter_getHeight(getCharacter(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+static zend_function_entry swfcharacter_functions[] = {
+ PHP_ME(swfcharacter, getWidth, NULL, 0)
+ PHP_ME(swfcharacter, getHeight, NULL, 0)
+ { NULL, NULL, NULL }
+};
+
/* }}} */
-/* {{{ getInput - utility func for making an SWFInput from an fopened resource
-*/
static void destroy_SWFInput_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
{
destroySWFInput((SWFInput)resource->ptr);
}
-static SWFInput getInput(zval **zfile TSRMLS_DC)
+/* {{{ getInput_fromFileResource - utility func for making an SWFInput from an fopened resource */
+static SWFInput getInput_fromFileResource(zval *zfile TSRMLS_DC)
{
FILE *file;
php_stream *stream;
SWFInput input;
- php_stream_from_zval_no_verify(stream, zfile);
+ php_stream_from_zval_no_verify(stream, &zfile);
- if (stream == NULL)
+ if (stream == NULL) {
return NULL;
+ }
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void *) &file, REPORT_ERRORS) != SUCCESS) {
return NULL;
}
input = newSWFInput_file(file);
- zend_list_addref(Z_LVAL_PP(zfile));
+ zend_list_addref(Z_LVAL_P(zfile));
zend_list_addref(zend_list_insert(input, le_swfinputp));
return input;
}
/* }}} */
-/* {{{ SWFAction
-*/
-/* {{{ proto void swfaction::__construct(string)
- Creates a new SWFAction object, compiling the given script */
-PHP_METHOD(swfaction, __construct)
+/* {{{ internal function getInput */
+static SWFInput getInput(zval *id TSRMLS_DC)
{
- SWFAction action;
- char *script;
- int script_len, ret;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script, &script_len) == FAILURE) {
- return;
- }
-
- action = compileSWFActionCode(script);
+ void *in = SWFgetProperty(id, "input", strlen("input"), le_swfinputp TSRMLS_CC);
- if (!action) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Couldn't compile actionscript");
+ if (!in) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFInput");
}
-
- ret = zend_list_insert(action, le_swfactionp);
-
- object_init_ex(getThis(), action_class_entry_ptr);
- add_property_resource(getThis(), "action", ret);
- zend_list_addref(ret);
+ return (SWFInput)in;
}
-/* no destructor for SWFAction, it's not a character */
/* }}} */
-/* {{{ internal function getAction
- Returns the SWFAction object contained in zval *id */
-static SWFAction getAction(zval *id TSRMLS_DC)
+
+/* {{{ proto void swfinput::__construct(string data) */
+PHP_METHOD(swfinput, __construct)
{
- void *action = SWFgetProperty(id, "action", 6, le_swfactionp TSRMLS_CC);
+ SWFInput input;
+ char *data;
+ long data_len;
+ int ret;
- if (!action) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFAction");
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) {
+ return;
}
- return (SWFAction)action;
+
+ input = newSWFInput_bufferCopy((unsigned char *)data, data_len);
+
+ ret = zend_list_insert(input, le_swfinputp);
+ object_init_ex(getThis(), input_class_entry_ptr);
+ add_property_resource(getThis(), "input", ret);
+ zend_list_addref(ret);
}
-/* }}} */
-static const zend_function_entry swfaction_functions[] = {
- PHP_ME(swfaction, __construct, NULL, 0)
+static zend_function_entry swfinput_functions[] = {
+ PHP_ME(swfinput, __construct, NULL, 0)
{ NULL, NULL, NULL }
};
/* }}} */
-/* {{{ SWFBitmap
-*/
-/* {{{ proto void swfbitmap::__construct(mixed file [, mixed maskfile])
- Creates a new SWFBitmap object from jpg (with optional mask) or dbl file */
-PHP_METHOD(swfbitmap, __construct)
+/* {{{ SWFFontCollection */
+static SWFFontCollection getFontCollection(zval *id TSRMLS_DC)
{
- zval **zfile, **zmask = NULL;
- SWFBitmap bitmap;
- SWFJpegWithAlpha bitmap_alpha;
- SWFInput input, maskinput;
+ void *fc = SWFgetProperty(id, "fontcollection", strlen("fontcollection"),
+ le_swffontcollectionp TSRMLS_CC);
+
+ if (!fc) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR,
+ "Called object is not an SWFFontCollection");
+ }
+ return (SWFFontCollection)fc;
+}
+
+/* {{{ proto swffontcollection::init(filename) */
+PHP_METHOD(swffontcollection, __construct)
+{
+ char *filename;
+ long filename_len;
int ret;
+ SWFFontCollection fc;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|Z", &zfile, &zmask) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
return;
}
-
- if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
- convert_to_string_ex(zfile);
- PHP_MING_FILE_CHK(Z_STRVAL_PP(zfile));
- input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- } else {
- input = getInput(zfile TSRMLS_CC);
- }
-
- if (zmask != NULL) {
- if (Z_TYPE_PP(zmask) != IS_RESOURCE) {
- convert_to_string_ex(zmask);
- maskinput = newSWFInput_buffer(Z_STRVAL_PP(zmask), Z_STRLEN_PP(zmask));
- zend_list_addref(zend_list_insert(maskinput, le_swfinputp));
- } else {
- maskinput = getInput(zmask TSRMLS_CC);
- }
- bitmap_alpha = newSWFJpegWithAlpha_fromInput(input, maskinput);
- if(bitmap_alpha) {
- ret = zend_list_insert(bitmap_alpha, le_swfbitmapp);
- object_init_ex(getThis(), bitmap_class_entry_ptr);
- add_property_resource(getThis(), "bitmap", ret);
- zend_list_addref(ret);
- }
- } else {
- bitmap = newSWFBitmap_fromInput(input);
- if(bitmap) {
- ret = zend_list_insert(bitmap, le_swfbitmapp);
- object_init_ex(getThis(), bitmap_class_entry_ptr);
- add_property_resource(getThis(), "bitmap", ret);
- zend_list_addref(ret);
- }
+
+ fc = newSWFFontCollection_fromFile(filename);
+ if(fc) {
+ ret = zend_list_insert(fc, le_swffontcollectionp);
+ object_init_ex(getThis(), fontcollection_class_entry_ptr);
+ add_property_resource(getThis(), "fontcollection", ret);
+ zend_list_addref(ret);
}
}
+/* }}} */
-static void destroy_SWFBitmap_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+/* {{{ proto long swffontcollection::getFontCount() */
+PHP_METHOD(swffontcollection, getFontCount)
{
- destroySWFBitmap((SWFBitmap)resource->ptr);
+ RETURN_LONG(SWFFontCollection_getFontCount(
+ getFontCollection(getThis() TSRMLS_CC)));
}
/* }}} */
-/* {{{ internal function getBitmap
- Returns the SWFBitmap object contained in zval *id */
-static SWFBitmap getBitmap(zval *id TSRMLS_DC)
+/* {{{ proto SWFFont swffontcollection::getFont(int index) */
+PHP_METHOD(swffontcollection, getFont)
{
- void *bitmap = SWFgetProperty(id, "bitmap", 6, le_swfbitmapp TSRMLS_CC);
-
- if (!bitmap) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFBitmap");
+ long index;
+ int ret;
+ SWFFont font;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) {
+ return;
}
- return (SWFBitmap)bitmap;
-}
-/* }}} */
-/* {{{ proto float swfbitmap::getWidth()
- Returns the width of this bitmap */
-PHP_METHOD(swfbitmap, getWidth)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
+ font = SWFFontCollection_getFont(getFontCollection(getThis() TSRMLS_CC), index);
+
+ if(font != NULL) {
+ ret = zend_list_insert(font, le_swffontp);
+ object_init_ex(return_value, font_class_entry_ptr);
+ add_property_resource(return_value, "font", ret);
+ zend_list_addref(ret);
}
- RETURN_DOUBLE(SWFBitmap_getWidth(getBitmap(getThis() TSRMLS_CC)));
}
/* }}} */
-/* {{{ proto float swfbitmap::getHeight()
- Returns the height of this bitmap */
-PHP_METHOD(swfbitmap, getHeight)
+static void destroy_SWFFontCollection_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- RETURN_DOUBLE(SWFBitmap_getHeight(getBitmap(getThis() TSRMLS_CC)));
+ destroySWFFontCollection((SWFFontCollection)resource->ptr);
}
-/* }}} */
-static const zend_function_entry swfbitmap_functions[] = {
- PHP_ME(swfbitmap, __construct, NULL, 0)
- PHP_ME(swfbitmap, getWidth, NULL, 0)
- PHP_ME(swfbitmap, getHeight, NULL, 0)
+static zend_function_entry swffontcollection_functions[] = {
+ PHP_ME(swffontcollection, __construct, NULL, 0)
+ PHP_ME(swffontcollection, getFont, NULL, 0)
+ PHP_ME(swffontcollection, getFontCount, NULL, 0)
{ NULL, NULL, NULL }
};
-
/* }}} */
-/* {{{ SWFButton
-*/
-/* {{{ proto void swfbutton::__construct()
- Creates a new SWFButton object */
-PHP_METHOD(swfbutton, __construct)
+
+/* {{{ SWFBrowserFont */
+static SWFBrowserFont getBrowserFont(zval *id TSRMLS_DC)
{
- SWFButton button = newSWFButton();
- int ret = zend_list_insert(button, le_swfbuttonp);
+ void *bf = SWFgetProperty(id, "browserfont", strlen("browserfont"),
+ le_swfbrowserfontp TSRMLS_CC);
- object_init_ex(getThis(), button_class_entry_ptr);
- add_property_resource(getThis(), "button", ret);
- zend_list_addref(ret);
+ if (!bf) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR,
+ "Called object is not an SWFBrowserFont");
+ }
+ return (SWFBrowserFont)bf;
}
-static void destroy_SWFButton_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+/* {{{ proto swfbrowserfont::_construct(fontname) */
+PHP_METHOD(swfbrowserfont, __construct)
{
- destroySWFButton((SWFButton)resource->ptr);
+ char *name;
+ long name_len;
+ int ret;
+ SWFBrowserFont font;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ return;
+ }
+
+ font = newSWFBrowserFont(name);
+ if(font) {
+ ret = zend_list_insert(font, le_swfbrowserfontp);
+ object_init_ex(getThis(), browserfont_class_entry_ptr);
+ add_property_resource(getThis(), "browserfont", ret);
+ zend_list_addref(ret);
+ }
}
/* }}} */
-/* {{{ internal function getButton
- Returns the SWFButton object contained in zval *id */
-static SWFButton getButton(zval *id TSRMLS_DC)
+static void destroy_SWFBrowserFont_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
{
- void *button = SWFgetProperty(id, "button", 6, le_swfbuttonp TSRMLS_CC);
+ destroySWFBrowserFont((SWFBrowserFont)resource->ptr);
+}
- if (!button) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFButton");
+static zend_function_entry swfbrowserfont_functions[] = {
+ PHP_ME(swfbrowserfont, __construct, NULL, 0)
+ { NULL, NULL, NULL }
+};
+/* }}} */
+/* {{{ SWFCXform
+*/
+/* {{{ proto void swfcxform::__construct([rAdd, gAdd, bAdd, aAdd, rMult, gMult, bMult, aMult]) */
+PHP_METHOD(swfcxform, __construct)
+{
+ SWFCXform cx;
+ int rAdd, gAdd, bAdd, aAdd;
+ double rMult, gMult, bMult, aMult;
+ int ret;
+
+ switch(ZEND_NUM_ARGS())
+ {
+ case 0:
+ cx = newSWFCXform(0, 0, 0, 0, 1.0, 1.0, 1.0, 1.0);
+ break;
+ case 8:
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllldddd",
+ &rAdd, &gAdd, &bAdd, &aAdd,
+ &rMult, &gMult, &bMult, &aMult) == FAILURE) {
+ return;
+ }
+ cx = newSWFCXform(rAdd, gAdd, bAdd, aAdd, rMult, gMult, bMult, aMult);
+ break;
+ default:
+ WRONG_PARAM_COUNT;
}
- return (SWFButton)button;
+
+ ret = zend_list_insert(cx, le_swfcxformp);
+ object_init_ex(getThis(), cxform_class_entry_ptr);
+ add_property_resource(getThis(), "cx", ret);
+ zend_list_addref(ret);
}
/* }}} */
-/* {{{ proto void swfbutton::setHit(object SWFCharacter)
- Sets the character for this button's hit test state */
-PHP_METHOD(swfbutton, setHit)
+/* {{{ proto void setColorAdd(r, g, b, a) */
+PHP_METHOD(swfcxform, setColorAdd)
{
- zval *zchar;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
+ int rAdd, gAdd, bAdd, aAdd;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &rAdd, &gAdd, &bAdd, &aAdd) == FAILURE) {
return;
}
- character = getCharacter(zchar TSRMLS_CC);
- SWFButton_addShape(button, character, SWFBUTTONRECORD_HITSTATE);
+ SWFCXform_setColorAdd(getCXform(getThis() TSRMLS_CC), rAdd, gAdd, bAdd, aAdd);
}
/* }}} */
-/* {{{ proto void swfbutton::setOver(object SWFCharacter)
- Sets the character for this button's over state */
-PHP_METHOD(swfbutton, setOver)
+/* {{{ proto void setColorMult(r, g, b, a) */
+PHP_METHOD(swfcxform, setColorMult)
{
- zval *zchar;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
+ double rMult, gMult, bMult, aMult;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &rMult, &gMult, &bMult, &aMult) == FAILURE) {
return;
}
- character = getCharacter(zchar TSRMLS_CC);
- SWFButton_addShape(button, character, SWFBUTTONRECORD_OVERSTATE);
+ SWFCXform_setColorMult(getCXform(getThis() TSRMLS_CC), rMult, gMult, bMult, aMult);
}
/* }}} */
-/* {{{ proto void swfbutton::setUp(object SWFCharacter)
- Sets the character for this button's up state */
-PHP_METHOD(swfbutton, setUp)
+static void destroy_SWFCXform_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
{
- zval *zchar;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
+ destroySWFCXform((SWFCXform)resource->ptr);
+}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
- return;
- }
+/* {{{ internal function getCXform */
+static SWFCXform getCXform(zval *id TSRMLS_DC)
+{
+ void *cx = SWFgetProperty(id, "cx", strlen("cx"), le_swfcxformp TSRMLS_CC);
- character = getCharacter(zchar TSRMLS_CC);
- SWFButton_addShape(button, character, SWFBUTTONRECORD_UPSTATE);
+ if (!cx) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFCXform");
+ }
+ return (SWFCXform)cx;
}
/* }}} */
-/* {{{ proto void swfbutton::setDown(object SWFCharacter)
- Sets the character for this button's down state */
-PHP_METHOD(swfbutton, setDown)
+static zend_function_entry swfcxform_functions[] = {
+ PHP_ME(swfcxform, __construct, NULL, 0)
+ PHP_ME(swfcxform, setColorAdd, NULL, 0)
+ PHP_ME(swfcxform, setColorMult, NULL, 0)
+ { NULL, NULL, NULL }
+};
+/* }}} */
+
+
+
+
+/* {{{ SWFMatrix */
+
+static SWFMatrix getMatrix(zval *id TSRMLS_DC)
{
- zval *zchar;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
+ void *matrix = SWFgetProperty(id, "matrix", strlen("matrix"), le_swfmatrixp TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
- return;
+ if(!matrix)
+ {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFMatrix");
}
+ return (SWFMatrix)matrix;
+}
- character = getCharacter(zchar TSRMLS_CC);
- SWFButton_addShape(button, character, SWFBUTTONRECORD_DOWNSTATE);
+/* {{{ proto double swfmatrix::getScaleX */
+PHP_METHOD(swfmatrix, getScaleX)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+ RETURN_DOUBLE(SWFMatrix_getScaleX(getMatrix(getThis() TSRMLS_CC)));
}
/* }}} */
-/* {{{ proto void swfbutton::addShape(object SWFCharacter, int flags)
- Sets the character to display for the condition described in flags */
-PHP_METHOD(swfbutton, addShape)
+/* {{{ proto double swfmatrix::getScaleX */
+PHP_METHOD(swfmatrix, getScaleY)
{
- zval *zchar;
- long flags;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zchar, &flags) == FAILURE) {
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
}
-
- character = getCharacter(zchar TSRMLS_CC);
- SWFButton_addShape(button, character, (byte)flags);
+ RETURN_DOUBLE(SWFMatrix_getScaleY(getMatrix(getThis() TSRMLS_CC)));
}
/* }}} */
-#ifdef HAVE_NEW_MING
-/* {{{ proto void swfbutton::setMenu(int flag)
- enable track as menu button behaviour */
-
-PHP_METHOD(swfbutton, setMenu)
+/* {{{ proto double swfmatrix::getRotate0 */
+PHP_METHOD(swfmatrix, getRotate0)
{
- long zflag;
- SWFButton button = getButton(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zflag) == FAILURE) {
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
}
+ RETURN_DOUBLE(SWFMatrix_getRotate0(getMatrix(getThis() TSRMLS_CC)));
+}
+/* }}} */
- SWFButton_setMenu(button, zflag);
+/* {{{ proto double swfmatrix::getRotate0 */
+PHP_METHOD(swfmatrix, getRotate1)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+ RETURN_DOUBLE(SWFMatrix_getRotate1(getMatrix(getThis() TSRMLS_CC)));
}
/* }}} */
-#endif
-/* {{{ proto void swfbutton::setAction(object SWFAction)
- Sets the action to perform when button is pressed */
-PHP_METHOD(swfbutton, setAction)
+/* {{{ proto double swfmatrix::getTranslateX */
+PHP_METHOD(swfmatrix, getTranslateX)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+ RETURN_DOUBLE(SWFMatrix_getTranslateX(getMatrix(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+/* {{{ proto double swfmatrix::getTranslateY */
+PHP_METHOD(swfmatrix, getTranslateY)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+ RETURN_DOUBLE(SWFMatrix_getTranslateY(getMatrix(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+static zend_function_entry swfmatrix_functions[] = {
+ PHP_ME(swfmatrix, getScaleX, NULL, 0)
+ PHP_ME(swfmatrix, getScaleY, NULL, 0)
+ PHP_ME(swfmatrix, getRotate0, NULL, 0)
+ PHP_ME(swfmatrix, getRotate1, NULL, 0)
+ PHP_ME(swfmatrix, getTranslateX, NULL, 0)
+ PHP_ME(swfmatrix, getTranslateY, NULL, 0)
+ {NULL, NULL, NULL}
+};
+/* }}} */
+
+/* {{{ SWFInitAction
+*/
+/* {{{ proto void swfinitaction::__construct(action)
+ Creates a new SWFInitAction object */
+PHP_METHOD(swfinitaction, __construct)
{
+ SWFInitAction init;
zval *zaction;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFAction action;
+ int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zaction) == FAILURE) {
return;
}
- action = getAction(zaction TSRMLS_CC);
- SWFButton_addAction(button, action, SWFBUTTON_OVERDOWNTOOVERUP);
+ init = newSWFInitAction(getAction(zaction TSRMLS_CC));
+
+ ret = zend_list_insert(init, le_swfinitactionp);
+ object_init_ex(getThis(), initaction_class_entry_ptr);
+ add_property_resource(getThis(), "initaction", ret);
+ zend_list_addref(ret);
}
+/* no destructor for SWFInitAction, it's not a character */
/* }}} */
-#ifdef HAVE_NEW_MING
-/* {{{ proto SWFSoundInstance swfbutton::addASound(SWFSound sound, int flags)
- associates a sound with a button transition
- NOTE: the transitions are all wrong _UP, _OVER, _DOWN _HIT */
+/* {{{ internal function getInitAction
+ Returns the SWFInitAction object contained in zval *id */
+static inline SWFInitAction getInitAction(zval *id TSRMLS_DC)
+{
+ void *action = SWFgetProperty(id, "initaction",
+ strlen("initaction"), le_swfinitactionp TSRMLS_CC);
-PHP_METHOD(swfbutton, addSound)
+ if (!action) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFInitAction");
+ }
+ return (SWFInitAction)action;
+}
+/* }}} */
+
+static zend_function_entry swfinitaction_functions[] = {
+ PHP_ME(swfinitaction, __construct, NULL, 0)
+ { NULL, NULL, NULL }
+};
+/* }}} */
+
+
+/* {{{ SWFAction
+*/
+/* {{{ proto void swfaction::__construct(string)
+ Creates a new SWFAction object, compiling the given script */
+PHP_METHOD(swfaction, __construct)
{
- zval *zsound;
- long flags;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFSound sound;
- SWFSoundInstance item;
+ SWFAction action;
+ char *script;
+ int script_len;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zsound, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script, &script_len) == FAILURE) {
return;
}
+
+ action = newSWFAction(script);
- sound = getSound(zsound TSRMLS_CC);
-
- item = SWFButton_addSound(button, sound, flags);
-
- if (item != NULL) {
- /* try and create a soundinstance object */
- ret = zend_list_insert(item, le_swfsoundinstancep);
- object_init_ex(return_value, soundinstance_class_entry_ptr);
- add_property_resource(return_value, "soundinstance", ret);
- zend_list_addref(ret);
+ if (!action) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Couldn't compile actionscript");
}
+
+ ret = zend_list_insert(action, le_swfactionp);
+
+ object_init_ex(getThis(), action_class_entry_ptr);
+ add_property_resource(getThis(), "action", ret);
+ zend_list_addref(ret);
}
+/* no destructor for SWFAction, it's not a character */
/* }}} */
-#endif
-/* {{{ proto void swfbutton::addAction(object SWFAction, int flags)
- Sets the action to perform when conditions described in flags is met */
-PHP_METHOD(swfbutton, addAction)
+/* {{{ proto long swfaction::compile(version) */
+PHP_METHOD(swfaction, compile)
{
- zval *zaction;
- long flags;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFAction action;
+ int version;
+ int len, ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zaction, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &version) == FAILURE) {
return;
}
- action = getAction(zaction TSRMLS_CC);
- SWFButton_addAction(button, action, flags);
+ ret = SWFAction_compile(getAction(getThis() TSRMLS_CC), version, &len);
+
+ if (ret != 0) {
+ RETURN_LONG(-1);
+ }
+ else {
+ RETURN_LONG(len);
+ }
}
/* }}} */
-/* {{{ proto int ming_keypress(string str)
- Returns the action flag for keyPress(char) */
-PHP_FUNCTION(ming_keypress)
+/* {{{ internal function getAction
+ Returns the SWFAction object contained in zval *id */
+static SWFAction getAction(zval *id TSRMLS_DC)
{
- char *key;
- int key_len;
- char c;
+ void *action = SWFgetProperty(id, "action", 6, le_swfactionp TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) {
+ if (!action) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFAction");
+ }
+ return (SWFAction)action;
+}
+/* }}} */
+
+static zend_function_entry swfaction_functions[] = {
+ PHP_ME(swfaction, __construct, NULL, 0)
+ PHP_ME(swfaction, compile, NULL, 0)
+ { NULL, NULL, NULL }
+};
+/* }}} */
+
+/* {{{ SWFBitmap
+*/
+/* {{{ proto void swfbitmap::__construct(filename or SWFInput [, maskfilename / SWFInput])
+ Creates a new SWFBitmap object from jpg (with optional mask) or dbl file */
+PHP_METHOD(swfbitmap, __construct)
+{
+ zval *zfile, *zmask = NULL;
+ SWFBitmap bitmap;
+ SWFJpegWithAlpha bitmap_alpha;
+ SWFInput input = NULL, maskinput = NULL;
+ int ret;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &zfile, &zmask) == FAILURE) {
return;
}
- if (key_len > 1) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Only one character expected");
+ switch(Z_TYPE_P(zfile))
+ {
+ case IS_RESOURCE:
+ input = getInput_fromFileResource(zfile TSRMLS_CC);
+ break;
+ case IS_OBJECT:
+ input = getInput(zfile TSRMLS_CC);
+ break;
+ case IS_STRING:
+ input = newSWFInput_filename(Z_STRVAL_P(zfile));
+ if(input == NULL)
+ php_error(E_ERROR, "opening bitmap file failed");
+ zend_list_addref(zend_list_insert(input, le_swfinputp));
+ break;
+
+ default:
+ php_error(E_ERROR, "swfbitmap::__construct: need either a filename, "
+ "a file ressource or SWFInput buffer.");
+ }
+
+ if (zmask != NULL) {
+ switch(Z_TYPE_P(zmask))
+ {
+ case IS_RESOURCE:
+ maskinput = getInput_fromFileResource(zmask TSRMLS_CC);
+ break;
+ case IS_OBJECT:
+ maskinput = getInput(zmask TSRMLS_CC);
+ break;
+ case IS_STRING:
+ maskinput = newSWFInput_filename(Z_STRVAL_P(zmask));
+ if(maskinput == NULL)
+ php_error(E_ERROR, "opening mask file failed");
+ zend_list_addref(zend_list_insert(maskinput, le_swfinputp));
+ break;
+
+ default:
+ php_error(E_ERROR, "swfbitmap::__construct: need either a filename, "
+ "a file ressource or SWFInput buffer.");
+ }
+
+ /* XXX: this is very optimistic! is it really a JPEG ?!? */
+ bitmap_alpha = newSWFJpegWithAlpha_fromInput(input, maskinput);
+ if(bitmap_alpha) {
+ ret = zend_list_insert(bitmap_alpha, le_swfbitmapp);
+ object_init_ex(getThis(), bitmap_class_entry_ptr);
+ add_property_resource(getThis(), "bitmap", ret);
+ zend_list_addref(ret);
+ }
+ } else {
+ bitmap = newSWFBitmap_fromInput(input);
+ if(bitmap) {
+ ret = zend_list_insert(bitmap, le_swfbitmapp);
+ object_init_ex(getThis(), bitmap_class_entry_ptr);
+ add_property_resource(getThis(), "bitmap", ret);
+ zend_list_addref(ret);
+ }
}
-
- c = key[0];
- RETURN_LONG((c&0x7f)<<9);
+}
+
+static void destroy_SWFBitmap_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+{
+ destroySWFBitmap((SWFBitmap)resource->ptr);
}
/* }}} */
-static const zend_function_entry swfbutton_functions[] = {
- PHP_ME(swfbutton, __construct, NULL, 0)
- PHP_ME(swfbutton, setHit, NULL, 0)
- PHP_ME(swfbutton, setOver, NULL, 0)
- PHP_ME(swfbutton, setUp, NULL, 0)
- PHP_ME(swfbutton, setDown, NULL, 0)
- PHP_ME(swfbutton, setAction, NULL, 0)
- PHP_ME(swfbutton, addShape, NULL, 0)
-#ifdef HAVE_NEW_MING
- PHP_ME(swfbutton, setMenu, NULL, 0)
-#endif
- PHP_ME(swfbutton, addAction, NULL, 0)
-#ifdef HAVE_NEW_MING
- PHP_ME(swfbutton, addSound, NULL, 0)
-#endif
+/* {{{ internal function getBitmap
+ Returns the SWFBitmap object contained in zval *id */
+static SWFBitmap getBitmap(zval *id TSRMLS_DC)
+{
+ void *bitmap = SWFgetProperty(id, "bitmap", 6, le_swfbitmapp TSRMLS_CC);
+
+ if (!bitmap) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFBitmap");
+ }
+ return (SWFBitmap)bitmap;
+}
+/* }}} */
+
+/* {{{ proto float swfbitmap::getWidth()
+ Returns the width of this bitmap */
+PHP_METHOD(swfbitmap, getWidth)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+ RETURN_DOUBLE(SWFBitmap_getWidth(getBitmap(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+/* {{{ proto float swfbitmap::getHeight()
+ Returns the height of this bitmap */
+PHP_METHOD(swfbitmap, getHeight)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+ RETURN_DOUBLE(SWFBitmap_getHeight(getBitmap(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+static zend_function_entry swfbitmap_functions[] = {
+ PHP_ME(swfbitmap, __construct, NULL, 0)
+ PHP_ME(swfbitmap, getWidth, NULL, 0)
+ PHP_ME(swfbitmap, getHeight, NULL, 0)
{ NULL, NULL, NULL }
};
/* }}} */
-/* {{{ SWFDisplayitem
-*/
-/* {{{ internal function getDisplayItem
- Returns the SWFDisplayItem contained in zval *id */
-static SWFDisplayItem getDisplayItem(zval *id TSRMLS_DC)
+#ifdef HAVE_NEW_MING
+/* {{{ internal function */
+static
+SWFButtonRecord getButtonRecord(zval *id TSRMLS_DC)
{
- void *item = SWFgetProperty(id, "displayitem", 11, le_swfdisplayitemp TSRMLS_CC);
+ void *record = SWFgetProperty(id, "buttonrecord", strlen("buttonrecord"), le_swfbuttonrecordp TSRMLS_CC);
- if (!item) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFDisplayItem");
+ if(!record)
+ php_error(E_ERROR, "called object is not an SWFButtonRecord!");
+
+ return (SWFButtonRecord)record;
+}
+/* }}} */
+
+/* {{{ proto void swfbuttoncharacter::setDepth(int depth)
+ sets a button characters depth */
+PHP_METHOD(swfbuttonrecord, setDepth)
+{
+ int depth;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &depth) == FAILURE) {
+ return;
}
+ SWFButtonRecord_setDepth(getButtonRecord(getThis() TSRMLS_CC), depth);
+}
+/* }}} */
- return (SWFDisplayItem)item;
+/* {{{ proto void swfbuttoncharacter::setBlendMode(int mode)
+ assigns a blend mode to a button's character */
+PHP_METHOD(swfbuttonrecord, setBlendMode)
+{
+ int mode;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mode) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_setBlendMode(getButtonRecord(getThis() TSRMLS_CC), mode);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::moveTo(float x, float y)
- Moves this SWFDisplayItem to movie coordinates (x, y) */
-PHP_METHOD(swfdisplayitem, moveTo)
+/* {{{ proto void swfbuttoncharacter::move(double x, double y)
+ relative placement */
+PHP_METHOD(swfbuttonrecord, move)
+{
+ double x, y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_move(getButtonRecord(getThis() TSRMLS_CC), x, y);
+}
+/* }}} */
+
+/* {{{ proto void swfbuttoncharacter::moveTo(double x, double y)
+ absolute placement */
+PHP_METHOD(swfbuttonrecord, moveTo)
{
double x, y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
+ SWFButtonRecord_moveTo(getButtonRecord(getThis() TSRMLS_CC), x, y);
+}
+/* }}} */
- SWFDisplayItem_moveTo(getDisplayItem(getThis() TSRMLS_CC), (float)x, (float)y);
+/* {{{ proto void swfbuttoncharacter::rotate(double deg)
+ relative rotation */
+PHP_METHOD(swfbuttonrecord, rotate)
+{
+ double deg;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_rotate(getButtonRecord(getThis() TSRMLS_CC), deg);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::move(float dx, float dy)
- Displaces this SWFDisplayItem by (dx, dy) in movie coordinates */
-PHP_METHOD(swfdisplayitem, move)
+/* {{{ proto void swfbuttoncharacter::rotateTo(double deg)
+ absolute rotation */
+PHP_METHOD(swfbuttonrecord, rotateTo)
+{
+ double deg;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_rotateTo(getButtonRecord(getThis() TSRMLS_CC), deg);
+}
+/* }}} */
+
+/* {{{ proto void swfbuttoncharacter::scale(double x, double y)
+ relative scaling */
+PHP_METHOD(swfbuttonrecord, scale)
+{
+ double x, y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_scale(getButtonRecord(getThis() TSRMLS_CC), x, y);
+}
+/* }}} */
+
+/* {{{ proto void swfbuttoncharacter::scaleTo(double x, double y)
+ absolute scaling */
+PHP_METHOD(swfbuttonrecord, scaleTo)
+{
+ double x, y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_scaleTo(getButtonRecord(getThis() TSRMLS_CC), x, y);
+}
+/* }}} */
+
+
+/* {{{ proto void swfbuttoncharacter::skewX(double x) */
+PHP_METHOD(swfbuttonrecord, skewX)
+{
+ double x;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_skewX(getButtonRecord(getThis() TSRMLS_CC), x);
+}
+/* }}} */
+
+/* {{{ proto void swfbuttoncharacter::skewXTo(double x) */
+PHP_METHOD(swfbuttonrecord, skewXTo)
+{
+ double x;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_skewXTo(getButtonRecord(getThis() TSRMLS_CC), x);
+}
+/* }}} */
+
+/* {{{ proto void swfbuttoncharacter::skewY(double y) */
+PHP_METHOD(swfbuttonrecord, skewY)
+{
+ double y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_skewY(getButtonRecord(getThis() TSRMLS_CC), y);
+}
+/* }}} */
+
+/* {{{ proto void swfbuttoncharacter::skewYTo(double y) */
+PHP_METHOD(swfbuttonrecord, skewYTo)
+{
+ double y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_skewYTo(getButtonRecord(getThis() TSRMLS_CC), y);
+}
+/* }}} */
+
+/* {{{ proto void swfbuttoncharacter::addFilter(SWFFilter f) */
+PHP_METHOD(swfbuttonrecord, addFilter)
+{
+ zval *filter;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &filter) == FAILURE) {
+ return;
+ }
+ SWFButtonRecord_addFilter(getButtonRecord(getThis() TSRMLS_CC), getFilter(filter TSRMLS_CC));
+}
+/* }}} */
+
+static zend_function_entry swfbuttonrecord_functions[] = {
+ PHP_ME(swfbuttonrecord, setDepth, NULL, 0)
+ PHP_ME(swfbuttonrecord, setBlendMode, NULL, 0)
+ PHP_ME(swfbuttonrecord, move, NULL, 0)
+ PHP_ME(swfbuttonrecord, moveTo, NULL, 0)
+ PHP_ME(swfbuttonrecord, rotate, NULL, 0)
+ PHP_ME(swfbuttonrecord, rotateTo, NULL, 0)
+ PHP_ME(swfbuttonrecord, scale, NULL, 0)
+ PHP_ME(swfbuttonrecord, scaleTo, NULL, 0)
+ PHP_ME(swfbuttonrecord, skewX, NULL, 0)
+ PHP_ME(swfbuttonrecord, skewXTo, NULL, 0)
+ PHP_ME(swfbuttonrecord, skewY, NULL, 0)
+ PHP_ME(swfbuttonrecord, skewYTo, NULL, 0)
+ PHP_ME(swfbuttonrecord, addFilter, NULL, 0)
+ { NULL, NULL, NULL }
+};
+#endif
+
+/* {{{ SWFButton
+*/
+/* {{{ proto void swfbutton::__construct()
+ Creates a new SWFButton object */
+PHP_METHOD(swfbutton, __construct)
+{
+ SWFButton button = newSWFButton();
+ int ret = zend_list_insert(button, le_swfbuttonp);
+
+ object_init_ex(getThis(), button_class_entry_ptr);
+ add_property_resource(getThis(), "button", ret);
+ zend_list_addref(ret);
+}
+
+static void destroy_SWFButton_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+{
+ destroySWFButton((SWFButton)resource->ptr);
+}
+/* }}} */
+
+/* {{{ internal function getButton
+ Returns the SWFButton object contained in zval *id */
+static SWFButton getButton(zval *id TSRMLS_DC)
+{
+ void *button = SWFgetProperty(id, "button", 6, le_swfbuttonp TSRMLS_CC);
+
+ if (!button) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFButton");
+ }
+ return (SWFButton)button;
+}
+/* }}} */
+
+/* {{{ proto void swfbutton::setHit(object SWFCharacter)
+ Sets the character for this button's hit test state */
+PHP_METHOD(swfbutton, setHit)
+{
+ zval *zchar;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ SWFCharacter character;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
+ }
+
+ character = getCharacter(zchar TSRMLS_CC);
+ SWFButton_addCharacter(button, character, SWFBUTTONRECORD_HITSTATE);
+}
+/* }}} */
+
+/* {{{ proto void swfbutton::setOver(object SWFCharacter)
+ Sets the character for this button's over state */
+PHP_METHOD(swfbutton, setOver)
+{
+ zval *zchar;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ SWFCharacter character;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
+ }
+
+ character = getCharacter(zchar TSRMLS_CC);
+ SWFButton_addCharacter(button, character, SWFBUTTONRECORD_OVERSTATE);
+}
+/* }}} */
+
+/* {{{ proto void swfbutton::setUp(object SWFCharacter)
+ Sets the character for this button's up state */
+PHP_METHOD(swfbutton, setUp)
+{
+ zval *zchar;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ SWFCharacter character;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
+ }
+
+ character = getCharacter(zchar TSRMLS_CC);
+ SWFButton_addCharacter(button, character, SWFBUTTONRECORD_UPSTATE);
+}
+/* }}} */
+
+/* {{{ proto void swfbutton::setDown(object SWFCharacter)
+ Sets the character for this button's down state */
+PHP_METHOD(swfbutton, setDown)
+{
+ zval *zchar;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ SWFCharacter character;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
+ }
+
+ character = getCharacter(zchar TSRMLS_CC);
+ SWFButton_addCharacter(button, character, SWFBUTTONRECORD_DOWNSTATE);
+}
+/* }}} */
+
+/* {{{ proto void swfbutton::addShape(object SWFCharacter, int flags)
+ Sets the character to display for the condition described in flags */
+PHP_METHOD(swfbutton, addShape)
+{
+ zval *zchar;
+ long flags;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ SWFCharacter character;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zchar, &flags) == FAILURE) {
+ return;
+ }
+
+ character = getCharacter(zchar TSRMLS_CC);
+ SWFButton_addCharacter(button, character, flags);
+}
+/* }}} */
+
+#ifdef HAVE_NEW_MING
+/* {{{ proto swfbuttonrecord swfbutton::addCharacter(object SWFCharacter, int flags)
+ Sets the character to display for the condition described in flags */
+PHP_METHOD(swfbutton, addCharacter)
+{
+ zval *zchar;
+ long flags;
+ SWFButtonRecord record;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ SWFCharacter character;
+ int ret;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zchar, &flags) == FAILURE) {
+ return;
+ }
+
+ character = getCharacter(zchar TSRMLS_CC);
+ record = SWFButton_addCharacter(button, character, flags);
+
+ if(record != NULL)
+ {
+ ret = zend_list_insert(record, le_swfbuttonrecordp);
+ object_init_ex(return_value, buttonrecord_class_entry_ptr);
+ add_property_resource(return_value, "buttonrecord", ret);
+ zend_list_addref(ret);
+ }
+}
+/* }}} */
+
+/* {{{ proto void swfbutton::setMenu(int flag)
+ enable track as menu button behaviour */
+PHP_METHOD(swfbutton, setMenu)
+{
+ long flag;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flag) == FAILURE) {
+ return;
+ }
+ SWFButton_setMenu(button, flag);
+}
+/* }}} */
+
+/* {{{ proto void swfbutton::setScalingGrid(int x, int y, int w, int h) */
+PHP_METHOD(swfbutton, setScalingGrid)
+{
+ long x, y, w, h;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &x, &y, &w, &h) == FAILURE) {
+ return;
+ }
+ SWFButton_setScalingGrid(button, x, y, w, h);
+}
+/* }}} */
+
+/* {{{ proto void swfbutton::removeScalingGrid() */
+PHP_METHOD(swfbutton, removeScalingGrid)
+{
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+ SWFButton_removeScalingGrid(button);
+}
+/* }}} */
+#endif
+
+/* {{{ proto void swfbutton::setAction(object SWFAction)
+ Sets the action to perform when button is pressed */
+PHP_METHOD(swfbutton, setAction)
+{
+ zval *zaction;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ SWFAction action;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zaction) == FAILURE) {
+ return;
+ }
+
+ action = getAction(zaction TSRMLS_CC);
+ SWFButton_addAction(button, action, SWFBUTTON_OVERDOWNTOOVERUP);
+}
+/* }}} */
+
+#ifdef HAVE_NEW_MING
+/* {{{ proto SWFSoundInstance swfbutton::addASound(SWFSound sound, int flags)
+ associates a sound with a button transition
+ NOTE: the transitions are all wrong _UP, _OVER, _DOWN _HIT */
+
+PHP_METHOD(swfbutton, addSound)
+{
+ zval *zsound;
+ long flags;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ SWFSound sound;
+ SWFSoundInstance item;
+ int ret;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zsound, &flags) == FAILURE) {
+ return;
+ }
+
+ sound = getSound(zsound TSRMLS_CC);
+ item = SWFButton_addSound(button, sound, flags);
+
+ if(item != NULL) {
+ /* try and create a soundinstance object */
+ ret = zend_list_insert(item, le_swfsoundinstancep);
+ object_init_ex(return_value, soundinstance_class_entry_ptr);
+ add_property_resource(return_value, "soundinstance", ret);
+ zend_list_addref(ret);
+ }
+}
+/* }}} */
+#endif
+
+/* {{{ proto void swfbutton::addAction(object SWFAction, int flags)
+ Sets the action to perform when conditions described in flags is met */
+PHP_METHOD(swfbutton, addAction)
+{
+ zval *zaction;
+ long flags;
+ SWFButton button = getButton(getThis() TSRMLS_CC);
+ SWFAction action;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zaction, &flags) == FAILURE) {
+ return;
+ }
+
+ action = getAction(zaction TSRMLS_CC);
+ SWFButton_addAction(button, action, flags);
+}
+/* }}} */
+
+/* {{{ proto int ming_keypress(string str)
+ Returns the action flag for keyPress(char) */
+PHP_FUNCTION(ming_keypress)
+{
+ char *key;
+ long key_len;
+ char c;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) {
+ return;
+ }
+
+ if (key_len > 1) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Only one character expected");
+ }
+
+ c = key[0];
+ RETURN_LONG((c&0x7f)<<9);
+}
+/* }}} */
+
+static zend_function_entry swfbutton_functions[] = {
+ PHP_ME(swfbutton, __construct, NULL, 0)
+ PHP_ME(swfbutton, setHit, NULL, 0)
+ PHP_ME(swfbutton, setOver, NULL, 0)
+ PHP_ME(swfbutton, setUp, NULL, 0)
+ PHP_ME(swfbutton, setDown, NULL, 0)
+ PHP_ME(swfbutton, setAction, NULL, 0)
+ PHP_ME(swfbutton, addShape, NULL, 0)
+#ifdef HAVE_NEW_MING
+ PHP_ME(swfbutton, setMenu, NULL, 0)
+ PHP_ME(swfbutton, setScalingGrid, NULL, 0)
+ PHP_ME(swfbutton, removeScalingGrid, NULL, 0)
+#endif
+ PHP_ME(swfbutton, addAction, NULL, 0)
+#ifdef HAVE_NEW_MING
+ PHP_ME(swfbutton, addSound, NULL, 0)
+ PHP_ME(swfbutton, addCharacter, NULL, 0)
+#endif
+ { NULL, NULL, NULL }
+};
+
+/* }}} */
+
+/* {{{ SWFDisplayItem
+*/
+/* {{{ internal function getDisplayItem
+ Returns the SWFDisplayItem contained in zval *id */
+static SWFDisplayItem getDisplayItem(zval *id TSRMLS_DC)
+{
+ void *item = SWFgetProperty(id, "displayitem", 11, le_swfdisplayitemp TSRMLS_CC);
+
+ if (!item) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFDisplayItem");
+ }
+
+ return (SWFDisplayItem)item;
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::moveTo(double x, double y)
+ Moves this SWFDisplayItem to movie coordinates (x, y) */
+PHP_METHOD(swfdisplayitem, moveTo)
+{
+ double x, y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_moveTo(getDisplayItem(getThis() TSRMLS_CC), x, y);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::move(double dx, double dy)
+ Displaces this SWFDisplayItem by (dx, dy) in movie coordinates */
+PHP_METHOD(swfdisplayitem, move)
+{
+ double x, y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_move(getDisplayItem(getThis() TSRMLS_CC), x, y);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::scaleTo(double xScale [, double yScale])
+ Scales this SWFDisplayItem by xScale in the x direction, yScale in the y, or both to xScale if only one arg */
+PHP_METHOD(swfdisplayitem, scaleTo)
+{
+ double x, y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|d", &x, &y) == FAILURE) {
+ return;
+ }
+
+ if (ZEND_NUM_ARGS() == 1) {
+ y = x;
+ }
+ SWFDisplayItem_scaleTo(getDisplayItem(getThis() TSRMLS_CC), x, y);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::scale(double xScale, double yScale)
+ Multiplies this SWFDisplayItem's current x scale by xScale, its y scale by yScale */
+PHP_METHOD(swfdisplayitem, scale)
+{
+ double x, y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_scale(getDisplayItem(getThis() TSRMLS_CC), x, y);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::rotateTo(double degrees)
+ Rotates this SWFDisplayItem the given (clockwise) degrees from its original orientation */
+PHP_METHOD(swfdisplayitem, rotateTo)
+{
+ double degrees;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_rotateTo(getDisplayItem(getThis() TSRMLS_CC), degrees);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::rotate(double degrees)
+ Rotates this SWFDisplayItem the given (clockwise) degrees from its current orientation */
+PHP_METHOD(swfdisplayitem, rotate)
+{
+ double degrees;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_rotate(getDisplayItem(getThis() TSRMLS_CC), degrees);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::skewXTo(double xSkew)
+ Sets this SWFDisplayItem's x skew value to xSkew */
+PHP_METHOD(swfdisplayitem, skewXTo)
+{
+ double x;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_skewXTo(getDisplayItem(getThis() TSRMLS_CC), x);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::skewX(double xSkew)
+ Adds xSkew to this SWFDisplayItem's x skew value */
+PHP_METHOD(swfdisplayitem, skewX)
+{
+ double x;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_skewX(getDisplayItem(getThis() TSRMLS_CC), x);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::skewYTo(double ySkew)
+ Sets this SWFDisplayItem's y skew value to ySkew */
+PHP_METHOD(swfdisplayitem, skewYTo)
+{
+ double y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_skewYTo(getDisplayItem(getThis() TSRMLS_CC), y);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::skewY(double ySkew)
+ Adds ySkew to this SWFDisplayItem's y skew value */
+PHP_METHOD(swfdisplayitem, skewY)
+{
+ double y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_skewY(getDisplayItem(getThis() TSRMLS_CC), y);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::setMatrix(double a, double b, double c, double d, double x, double y)
+ Sets the item's transform matrix */
+PHP_METHOD(swfdisplayitem, setMatrix)
+{
+ double a, b, c, d, x, y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &a, &b, &c, &d, &x, &y) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_setMatrix( getDisplayItem(getThis() TSRMLS_CC), a, b, c, d, x, y);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::setDepth(int depth)
+ Sets this SWFDisplayItem's z-depth to depth. Items with higher depth values are drawn on top of those with lower values */
+PHP_METHOD(swfdisplayitem, setDepth)
+{
+ long depth;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &depth) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_setDepth(getDisplayItem(getThis() TSRMLS_CC), depth);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::setRatio(float ratio)
+ Sets this SWFDisplayItem's ratio to ratio. Obviously only does anything if displayitem was created from an SWFMorph */
+PHP_METHOD(swfdisplayitem, setRatio)
+{
+ double ratio;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &ratio) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_setRatio(getDisplayItem(getThis() TSRMLS_CC), ratio);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::addColor(int r, int g, int b [, int a])
+ Sets the add color part of this SWFDisplayItem's CXform to (r, g, b [, a]), a defaults to 0 */
+PHP_METHOD(swfdisplayitem, addColor)
+{
+ long r, g, b, a = 0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &r, &g, &b, &a) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_setColorAdd(getDisplayItem(getThis() TSRMLS_CC), r, g, b, (int)a);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::multColor(float r, float g, float b [, float a])
+ Sets the multiply color part of this SWFDisplayItem's CXform to (r, g, b [, a]), a defaults to 1.0 */
+PHP_METHOD(swfdisplayitem, multColor)
+{
+ double r, g, b, a = 1.0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd|d", &r, &g, &b, &a) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_setColorMult(getDisplayItem(getThis() TSRMLS_CC), r, g, b, a);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::setName(string name)
+ Sets this SWFDisplayItem's name to name */
+PHP_METHOD(swfdisplayitem, setName)
+{
+ char *name;
+ int name_len;
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_setName(item, name);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::addAction(object SWFAction, int flags)
+ Adds this SWFAction to the given SWFSprite instance */
+PHP_METHOD(swfdisplayitem, addAction)
+{
+ zval *zaction;
+ long flags;
+ SWFAction action;
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zaction, &flags) == FAILURE) {
+ return;
+ }
+
+ action = getAction(zaction TSRMLS_CC);
+ SWFDisplayItem_addAction(item, action, flags);
+}
+/* }}} */
+
+#ifdef HAVE_NEW_MING
+/* {{{ swfdisplayitem_remove */
+
+PHP_METHOD(swfdisplayitem, remove)
+{
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_remove(item);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::setMaskLevel(int level)
+ defines a MASK layer at level */
+
+PHP_METHOD(swfdisplayitem, setMaskLevel)
+{
+ long level;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_setMaskLevel(getDisplayItem(getThis() TSRMLS_CC), level);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::endMask()
+ another way of defining a MASK layer */
+
+PHP_METHOD(swfdisplayitem, endMask)
+{
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_endMask(item);
+}
+/* }}} */
+
+/* {{{ swfdisplayitem_getX */
+
+PHP_METHOD(swfdisplayitem, getX)
+{
+ double x, y;
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_getPosition(item, &x, &y);
+ RETURN_DOUBLE(x);
+}
+/* }}} */
+
+/* {{{ swfdisplayitem_getY */
+
+PHP_METHOD(swfdisplayitem, getY)
+{
+ double x, y;
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_getPosition(item, &x, &y);
+ RETURN_DOUBLE(y);
+}
+/* }}} */
+
+/* {{{ swfdisplayitem_getXScale */
+
+PHP_METHOD(swfdisplayitem, getXScale)
+{
+ double sx, sy;
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_getScale(item, &sx, &sy);
+ RETURN_DOUBLE(sx);
+}
+/* }}} */
+
+/* {{{ swfdisplayitem_getYScale */
+
+PHP_METHOD(swfdisplayitem, getYScale)
+{
+ double sx, sy;
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_getScale(item, &sx, &sy);
+ RETURN_DOUBLE(sy);
+}
+/* }}} */
+
+/* {{{ swfdisplayitem_getXSkew */
+
+PHP_METHOD(swfdisplayitem, getXSkew)
+{
+ double sx, sy;
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_getSkew(item, &sx, &sy);
+ RETURN_DOUBLE(sx);
+}
+/* }}} */
+
+/* {{{ swfdisplayitem_getYSkew */
+
+PHP_METHOD(swfdisplayitem, getYSkew)
+{
+ double sx, sy;
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_getSkew(item, &sx, &sy);
+ RETURN_DOUBLE(sy);
+}
+/* }}} */
+
+/* {{{ swfdisplayitem_getRot */
+
+PHP_METHOD(swfdisplayitem, getRot)
+{
+ double ret;
+ SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_getRotation(item, &ret);
+ RETURN_DOUBLE(ret);
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::cacheAsBitmap(int flag)
+ caches item as bitmap. can improve rendering speed */
+
+PHP_METHOD(swfdisplayitem, cacheAsBitmap)
+{
+ long flag;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flag) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_cacheAsBitmap(getDisplayItem(getThis() TSRMLS_CC), flag);
+}
+/* }}} */
+
+
+/* {{{ proto void swfdisplayitem::setBlendMode(int mode)
+ adds blending to item */
+PHP_METHOD(swfdisplayitem, setBlendMode)
+{
+ long mode;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mode) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_cacheAsBitmap(getDisplayItem(getThis() TSRMLS_CC), mode);
+}
+/* }}} */
+
+/* {{{ proto int swfdisplayitem::setDepth()
+ gets the items depth */
+PHP_METHOD(swfdisplayitem, getDepth)
+{
+ int ret;
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ ret = SWFDisplayItem_getDepth(getDisplayItem(getThis() TSRMLS_CC));
+ RETURN_LONG(ret);
+}
+/* }}} */
+
+/* {{{ proto int swfdisplayitem::flush() */
+PHP_METHOD(swfdisplayitem, flush)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFDisplayItem_flush(getDisplayItem(getThis() TSRMLS_CC));
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::addFilter(SWFFilter filter) */
+PHP_METHOD(swfdisplayitem, addFilter)
+{
+ zval *filter;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &filter) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_addFilter(getDisplayItem(getThis() TSRMLS_CC), getFilter(filter TSRMLS_CC));
+
+}
+/* }}} */
+
+/* {{{ proto void swfdisplayitem::setCXform(cx) */
+PHP_METHOD(swfdisplayitem, setCXform)
+{
+ zval *cx;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &cx) == FAILURE) {
+ return;
+ }
+
+ SWFDisplayItem_setCXform(getDisplayItem(getThis() TSRMLS_CC), getCXform(cx TSRMLS_CC));
+}
+/* }}} */
+
+/** {{{ proto void swfdisplayitem::getMatrix() */
+PHP_METHOD(swfdisplayitem, getMatrix)
+{
+ SWFMatrix m;
+ int ret;
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ m = SWFDisplayItem_getMatrix(getDisplayItem(getThis() TSRMLS_CC));
+ if(m != NULL)
+ {
+ ret = zend_list_insert(m, le_swfmatrixp);
+ object_init_ex(return_value, matrix_class_entry_ptr);
+ add_property_resource(return_value, "matrix", ret);
+ zend_list_addref(ret);
+ }
+}
+/* }}} */
+
+/** {{{ proto void swfdisplayitem::getCharacter() */
+PHP_METHOD(swfdisplayitem, getCharacter)
+{
+ SWFCharacter c;
+ int ret;
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ c = SWFDisplayItem_getCharacter(getDisplayItem(getThis() TSRMLS_CC));
+ if(c != NULL)
+ {
+ ret = zend_list_insert(c, le_swfcharacterp);
+ object_init_ex(return_value, character_class_entry_ptr);
+ add_property_resource(return_value, "character", ret);
+ zend_list_addref(ret);
+ }
+}
+/* }}} */
+
+#endif
+
+static zend_function_entry swfdisplayitem_functions[] = {
+ PHP_ME(swfdisplayitem, moveTo, NULL, 0)
+ PHP_ME(swfdisplayitem, move, NULL, 0)
+ PHP_ME(swfdisplayitem, scaleTo, NULL, 0)
+ PHP_ME(swfdisplayitem, scale, NULL, 0)
+ PHP_ME(swfdisplayitem, rotateTo, NULL, 0)
+ PHP_ME(swfdisplayitem, rotate, NULL, 0)
+ PHP_ME(swfdisplayitem, skewXTo, NULL, 0)
+ PHP_ME(swfdisplayitem, skewX, NULL, 0)
+ PHP_ME(swfdisplayitem, skewYTo, NULL, 0)
+ PHP_ME(swfdisplayitem, skewY, NULL, 0)
+ PHP_ME(swfdisplayitem, setMatrix, NULL, 0)
+ PHP_ME(swfdisplayitem, setDepth, NULL, 0)
+ PHP_ME(swfdisplayitem, setRatio, NULL, 0)
+ PHP_ME(swfdisplayitem, addColor, NULL, 0)
+ PHP_ME(swfdisplayitem, multColor, NULL, 0)
+ PHP_ME(swfdisplayitem, setName, NULL, 0)
+ PHP_ME(swfdisplayitem, addAction, NULL, 0)
+#ifdef HAVE_NEW_MING
+ PHP_ME(swfdisplayitem, remove, NULL, 0)
+ PHP_ME(swfdisplayitem, setMaskLevel,NULL, 0)
+ PHP_ME(swfdisplayitem, endMask, NULL, 0)
+ PHP_ME(swfdisplayitem, getX, NULL, 0)
+ PHP_ME(swfdisplayitem, getY, NULL, 0)
+ PHP_ME(swfdisplayitem, getXScale, NULL, 0)
+ PHP_ME(swfdisplayitem, getYScale, NULL, 0)
+ PHP_ME(swfdisplayitem, getXSkew, NULL, 0)
+ PHP_ME(swfdisplayitem, getYSkew, NULL, 0)
+ PHP_ME(swfdisplayitem, getRot, NULL, 0)
+ PHP_ME(swfdisplayitem, cacheAsBitmap, NULL, 0)
+ PHP_ME(swfdisplayitem, setBlendMode, NULL, 0)
+ PHP_ME(swfdisplayitem, getDepth, NULL, 0)
+ PHP_ME(swfdisplayitem, flush, NULL, 0)
+ PHP_ME(swfdisplayitem, addFilter, NULL, 0)
+ PHP_ME(swfdisplayitem, setCXform, NULL, 0)
+ PHP_ME(swfdisplayitem, getCharacter, NULL, 0)
+#endif
+ { NULL, NULL, NULL }
+};
+
+/* }}} */
+
+/* {{{ SWFFill
+*/
+/* {{{ proto void swffill::__construct()
+ Creates a new SWFFill object */
+PHP_METHOD(swffill, __construct)
+{
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Instantiating SWFFill won't do any good- use SWFShape::addFill() instead");
+}
+
+static void destroy_SWFFill_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+{
+ /* this only destroys the shallow wrapper for SWFFillStyle,
+ which SWFShape destroys. So everything's okay. I hope. */
+
+ destroySWFFill((SWFFill)resource->ptr);
+}
+/* }}} */
+
+/* {{{ internal function getFill
+ Returns the SWFFill object contained in zval *id */
+static SWFFill getFill(zval *id TSRMLS_DC)
+{
+ void *fill = SWFgetProperty(id, "fill", 4, le_swffillp TSRMLS_CC);
+
+ if (!fill) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFFill");
+ }
+ return (SWFFill)fill;
+}
+/* }}} */
+
+/* {{{ proto void swffill::moveTo(float x, float y)
+ Moves this SWFFill to shape coordinates (x,y) */
+PHP_METHOD(swffill, moveTo)
+{
+ double x, y;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
+ }
+
+ SWFFill_moveTo(getFill(getThis() TSRMLS_CC), x, y);
+}
+/* }}} */
+
+/* {{{ proto void swffill::move(float dx, float dy)
+ Moves this SWFFill by (dx,dy) */
+PHP_METHOD(swffill, move)
{
double x, y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
-
- SWFDisplayItem_move(getDisplayItem(getThis() TSRMLS_CC), (float)x, (float)y);
+
+ SWFFill_move(getFill(getThis() TSRMLS_CC), x, y);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::scaleTo(float xScale [, float yScale])
- Scales this SWFDisplayItem by xScale in the x direction, yScale in the y, or both to xScale if only one arg */
-PHP_METHOD(swfdisplayitem, scaleTo)
+
+/* {{{ proto void swffill::scaleTo(float xScale [, float yScale])
+ Scales this SWFFill by xScale in the x direction, yScale in the y, or both to xScale if only one arg */
+PHP_METHOD(swffill, scaleTo)
{
double x, y;
- int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "d|d", &x, &y) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|d", &x, &y) == FAILURE) {
return;
}
-
- SWFDisplayItem_scaleTo(getDisplayItem(getThis() TSRMLS_CC), (float)x, (float) (argc == 1 ? x : y));
+
+ if (ZEND_NUM_ARGS() == 1) {
+ y = x;
+ }
+ SWFFill_scaleXYTo(getFill(getThis() TSRMLS_CC), x, y);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::scale(float xScale, float yScale)
- Multiplies this SWFDisplayItem's current x scale by xScale, its y scale by yScale */
-PHP_METHOD(swfdisplayitem, scale)
+/* {{{ proto void swffill::scale(float xScale [, float yScale])
+ Scales this SWFFill by xScale in the x direction, yScale in the y, or both to xScale if only one arg */
+PHP_METHOD(swffill, scale)
{
double x, y;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|d", &x, &y) == FAILURE) {
return;
}
- SWFDisplayItem_scale(getDisplayItem(getThis() TSRMLS_CC), (float)x, (float)y);
+ if (ZEND_NUM_ARGS() == 1) {
+ y = x;
+ }
+ SWFFill_scaleXY(getFill(getThis() TSRMLS_CC), x, y);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::rotateTo(float degrees)
- Rotates this SWFDisplayItem the given (clockwise) degrees from its original orientation */
-PHP_METHOD(swfdisplayitem, rotateTo)
+
+/* {{{ proto void swffill::rotateTo(float degrees)
+ Rotates this SWFFill the given (clockwise) degrees from its original orientation */
+PHP_METHOD(swffill, rotateTo)
{
double degrees;
return;
}
- SWFDisplayItem_rotateTo(getDisplayItem(getThis() TSRMLS_CC), (float)degrees);
+ SWFFill_rotateTo(getFill(getThis() TSRMLS_CC), degrees);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::rotate(float degrees)
- Rotates this SWFDisplayItem the given (clockwise) degrees from its current orientation */
-PHP_METHOD(swfdisplayitem, rotate)
+/* {{{ proto void swffill::rotate(float degrees)
+ Rotates this SWFFill the given (clockwise) degrees from its current orientation */
+PHP_METHOD(swffill, rotate)
{
double degrees;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
return;
}
-
- SWFDisplayItem_rotate(getDisplayItem(getThis() TSRMLS_CC), (float)degrees);
+
+ SWFFill_rotate(getFill(getThis() TSRMLS_CC), degrees);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::skewXTo(float xSkew)
- Sets this SWFDisplayItem's x skew value to xSkew */
-PHP_METHOD(swfdisplayitem, skewXTo)
+
+/* {{{ proto void swffill::skewXTo(float xSkew)
+ Sets this SWFFill's x skew value to xSkew */
+PHP_METHOD(swffill, skewXTo)
{
double x;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
return;
}
-
- SWFDisplayItem_skewXTo(getDisplayItem(getThis() TSRMLS_CC), (float)x);
+
+ SWFFill_skewXTo(getFill(getThis() TSRMLS_CC), x);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::skewX(float xSkew)
- Adds xSkew to this SWFDisplayItem's x skew value */
-PHP_METHOD(swfdisplayitem, skewX)
+/* {{{ proto void swffill::skewX(float xSkew)
+ Sets this SWFFill's x skew value to xSkew */
+PHP_METHOD(swffill, skewX)
{
double x;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
return;
}
-
- SWFDisplayItem_skewX(getDisplayItem(getThis() TSRMLS_CC), (float)x);
+
+ SWFFill_skewX(getFill(getThis() TSRMLS_CC), x);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::skewYTo(float ySkew)
- Sets this SWFDisplayItem's y skew value to ySkew */
-PHP_METHOD(swfdisplayitem, skewYTo)
+/* {{{ proto void swffill::skewYTo(float ySkew)
+ Sets this SWFFill's y skew value to ySkew */
+PHP_METHOD(swffill, skewYTo)
{
double y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
return;
}
-
- SWFDisplayItem_skewYTo(getDisplayItem(getThis() TSRMLS_CC), (float)y);
+
+ SWFFill_skewYTo(getFill(getThis() TSRMLS_CC), y);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::skewY(float ySkew)
- Adds ySkew to this SWFDisplayItem's y skew value */
-PHP_METHOD(swfdisplayitem, skewY)
+/* {{{ proto void swffill::skewY(float ySkew)
+ Sets this SWFFill's y skew value to ySkew */
+PHP_METHOD(swffill, skewY)
{
double y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
return;
}
-
- SWFDisplayItem_skewY(getDisplayItem(getThis() TSRMLS_CC), (float)y);
+
+ SWFFill_skewY(getFill(getThis() TSRMLS_CC), y);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::setMatrix(float a, float b, float c, float d, float x, float y)
- Sets the item's transform matrix */
-PHP_METHOD(swfdisplayitem, setMatrix)
+/* {{{ proto void swffill::setMatrix(float a, float b, float c, float d, float x, float y)
+ Sets this SWFFill's y matrix values */
+PHP_METHOD(swffill, setMatrix)
{
double a, b, c, d, x, y;
return;
}
- SWFDisplayItem_setMatrix(getDisplayItem(getThis() TSRMLS_CC), (float)a, (float)b, (float)c, (float)d, (float)x, (float)y);
+ SWFFill_setMatrix(getFill(getThis() TSRMLS_CC), a, b, c, d, x, y);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::setDepth(int depth)
- Sets this SWFDisplayItem's z-depth to depth. Items with higher depth values are drawn on top of those with lower values */
-PHP_METHOD(swfdisplayitem, setDepth)
-{
- long depth;
+static zend_function_entry swffill_functions[] = {
+ PHP_ME(swffill, __construct, NULL, 0)
+ PHP_ME(swffill, moveTo, NULL, 0)
+ PHP_ME(swffill, move, NULL, 0)
+ PHP_ME(swffill, scaleTo, NULL, 0)
+ PHP_ME(swffill, scale, NULL, 0)
+ PHP_ME(swffill, rotateTo, NULL, 0)
+ PHP_ME(swffill, rotate, NULL, 0)
+ PHP_ME(swffill, skewXTo, NULL, 0)
+ PHP_ME(swffill, skewX, NULL, 0)
+ PHP_ME(swffill, skewYTo, NULL, 0)
+ PHP_ME(swffill, skewY, NULL, 0)
+ PHP_ME(swffill, setMatrix, NULL, 0)
+ { NULL, NULL, NULL }
+};
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &depth) == FAILURE) {
- return;
- }
-
- SWFDisplayItem_setDepth(getDisplayItem(getThis() TSRMLS_CC), depth);
-}
/* }}} */
-/* {{{ proto void swfdisplayitem::setRatio(float ratio)
- Sets this SWFDisplayItem's ratio to ratio. Obviously only does anything if displayitem was created from an SWFMorph */
-PHP_METHOD(swfdisplayitem, setRatio)
+/* {{{ SWFFontCharacter */
+#ifdef HAVE_NEW_MING
+
+/* {{{ internal function SWFText getFont(zval *id)
+ Returns the Font object in zval *id */
+static
+SWFFontCharacter getFontCharacter(zval *id TSRMLS_DC)
{
- double ratio;
+ void *font = SWFgetProperty(id, "fontcharacter", 13, le_swffontcharp TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &ratio) == FAILURE) {
- return;
- }
+ if(!font)
+ php_error(E_ERROR, "called object is not an SWFFontCharacter!");
- SWFDisplayItem_setRatio(getDisplayItem(getThis() TSRMLS_CC), (float)ratio);
+ return (SWFFontCharacter)font;
}
/* }}} */
-/* {{{ proto void swfdisplayitem::addColor(int r, int g, int b [, int a])
- Sets the add color part of this SWFDisplayItem's CXform to (r, g, b [, a]), a defaults to 0 */
-PHP_METHOD(swfdisplayitem, addColor)
+/* {{{ proto void swffontcha::raddChars(string)
+ adds characters to a font for exporting font */
+PHP_METHOD(swffontchar, addChars)
{
- long r, g, b, a = 0;
+ char *string;
+ long string_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &r, &g, &b, &a) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
return;
}
- SWFDisplayItem_setColorAdd(getDisplayItem(getThis() TSRMLS_CC), r, g, b, (int)a);
+ SWFFontCharacter_addChars(getFontCharacter(getThis() TSRMLS_CC), string);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::multColor(float r, float g, float b [, float a])
- Sets the multiply color part of this SWFDisplayItem's CXform to (r, g, b [, a]), a defaults to 1.0 */
-PHP_METHOD(swfdisplayitem, multColor)
+/* {{{ proto void swffontchar::addChars(string)
+ adds characters to a font for exporting font */
+
+PHP_METHOD(swffontchar, addUTF8Chars)
{
- double r, g, b, a = 1.0;
+ char *string;
+ long string_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd|d", &r, &g, &b, &a) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
return;
}
- SWFDisplayItem_setColorMult(getDisplayItem(getThis() TSRMLS_CC), (float)r, (float)g, (float)b, (float)a);
+ SWFFontCharacter_addUTF8Chars(getFontCharacter(getThis() TSRMLS_CC), string);
}
/* }}} */
-/* {{{ proto void swfdisplayitem::setName(string name)
- Sets this SWFDisplayItem's name to name */
-PHP_METHOD(swfdisplayitem, setName)
-{
- char *name;
- int name_len;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+/* {{{ proto void swffontchar::addAllChars()
+ * adds all characters to a font for exporting font */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
- return;
+PHP_METHOD(swffontchar, addAllChars)
+{
+ if (ZEND_NUM_ARGS() != 0 ) {
+ WRONG_PARAM_COUNT;
}
- SWFDisplayItem_setName(item, name);
+ SWFFontCharacter_addAllChars(getFontCharacter(getThis() TSRMLS_CC));
}
/* }}} */
-/* {{{ proto void swfdisplayitem::addAction(object SWFAction, int flags)
- Adds this SWFAction to the given SWFSprite instance */
-PHP_METHOD(swfdisplayitem, addAction)
-{
- zval *zaction;
- long flags;
- SWFAction action;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zaction, &flags) == FAILURE) {
- return;
- }
+static zend_function_entry swffontchar_functions[] = {
+ PHP_ME(swffontchar, addChars, NULL, 0)
+ PHP_ME(swffontchar, addUTF8Chars, NULL, 0)
+ PHP_ME(swffontchar, addAllChars, NULL, 0)
+ { NULL, NULL, NULL }
+};
- action = getAction(zaction TSRMLS_CC);
- SWFDisplayItem_addAction(item, action, flags);
-}
+#endif
/* }}} */
-#ifdef HAVE_NEW_MING
-/* {{{ swfdisplayitem_remove */
-
-PHP_METHOD(swfdisplayitem, remove)
+/* {{{ SWFFont
+*/
+/* {{{ internal function SWFText getFont(zval *id)
+ Returns the Font object in zval *id */
+static SWFFont getFont(zval *id TSRMLS_DC)
{
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+ void *font = SWFgetProperty(id, "font", 4, le_swffontp TSRMLS_CC);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
+ if (!font) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFFont");
}
- SWFDisplayItem_remove(item);
+ return (SWFFont)font;
}
/* }}} */
-/* {{{ proto void swfdisplayitem::setMaskLevel(int level)
- defines a MASK layer at level */
-
-PHP_METHOD(swfdisplayitem, setMaskLevel)
+/* {{{ proto void swffont::__construct(string filename)
+ Creates a new SWFFont object from given file */
+PHP_METHOD(swffont, __construct)
{
- long level;
+ char *file;
+ long file_len;
+ SWFFont font;
+ int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
return;
}
- SWFDisplayItem_setMaskLevel(getDisplayItem(getThis() TSRMLS_CC), level);
-}
-/* }}} */
+ PHP_MING_FILE_CHK(file);
+ font = newSWFFont_fromFile(file);
-/* {{{ proto void swfdisplayitem::endMask()
- another way of defining a MASK layer */
+ if(font == NULL)
+ {
+ php_error(E_ERROR, "Loading font failed! "
+ "Please use new SWFBrowserFont(string:fontname) "
+ "for player/browser fonts.");
+
+ }
+
+ if(font)
+ {
+ ret = zend_list_insert(font, le_swffontp);
+ object_init_ex(getThis(), font_class_entry_ptr);
+ add_property_resource(getThis(), "font", ret);
+ zend_list_addref(ret);
+ }
+}
-PHP_METHOD(swfdisplayitem, endMask)
+static void destroy_SWFFont_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
{
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- SWFDisplayItem_endMask(item);
+ destroySWFBlock((SWFBlock)resource->ptr);
}
/* }}} */
-/* {{{ swfdisplayitem_getX */
-
-PHP_METHOD(swfdisplayitem, getX)
+/* {{{ proto float swffont::getWidth(string str)
+ Calculates the width of the given string in this font at full height */
+PHP_METHOD(swffont, getWidth)
{
- float ret;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+ char *string;
+ long string_len;
+ float width;
- if (zend_parse_parameters_none() == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
return;
}
- ret = SWFDisplayItem_get_x(item);
- RETURN_DOUBLE(ret);
+
+ width = SWFFont_getStringWidth(getFont(getThis() TSRMLS_CC), string);
+ RETURN_DOUBLE(width);
}
/* }}} */
-/* {{{ swfdisplayitem_getY */
+#ifdef HAVE_NEW_MING
+/* {{{ proto int swffont::getUTF8Width(string)
+ Calculates the width of the given string in this font at full height */
-PHP_METHOD(swfdisplayitem, getY)
+PHP_METHOD(swffont, getUTF8Width)
{
- float ret;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
+ char *string;
+ long string_len;
+ float width;
- if (zend_parse_parameters_none() == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
return;
}
- ret = SWFDisplayItem_get_y(item);
- RETURN_DOUBLE(ret);
-}
-/* }}} */
-/* {{{ swfdisplayitem_getXScale */
+ width = SWFFont_getUTF8StringWidth(getFont(getThis() TSRMLS_CC), string);
+ RETURN_DOUBLE(width);
+}
-PHP_METHOD(swfdisplayitem, getXScale)
+/* {{{ proto int swffont::getglyphcount() */
+PHP_METHOD(swffont, getGlyphCount)
{
- float ret;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- ret = SWFDisplayItem_get_xScale(item);
- RETURN_DOUBLE(ret);
+ RETURN_LONG(SWFFont_getGlyphCount(getFont(getThis() TSRMLS_CC)));
}
/* }}} */
-/* {{{ swfdisplayitem_getYScale */
-
-PHP_METHOD(swfdisplayitem, getYScale)
+/* {{{ proto string swffont::getname() */
+PHP_METHOD(swffont, getName)
{
- float ret;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- ret = SWFDisplayItem_get_yScale(item);
- RETURN_DOUBLE(ret);
+ RETURN_STRING(SWFFont_getName(getFont(getThis() TSRMLS_CC)), 0);
}
/* }}} */
+#endif
-/* {{{ swfdisplayitem_getXSkew */
-
-PHP_METHOD(swfdisplayitem, getXSkew)
+/* {{{ proto float swffont::getAscent()
+ Returns the ascent of the font, or 0 if not available */
+PHP_METHOD(swffont, getAscent)
{
- float ret;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
}
- ret = SWFDisplayItem_get_xSkew(item);
- RETURN_DOUBLE(ret);
+ RETURN_DOUBLE(SWFFont_getAscent(getFont(getThis() TSRMLS_CC)));
}
/* }}} */
-/* {{{ swfdisplayitem_getYSkew */
-
-PHP_METHOD(swfdisplayitem, getYSkew)
+/* {{{ proto float swffont::getDescent()
+ Returns the descent of the font, or 0 if not available */
+PHP_METHOD(swffont, getDescent)
{
- float ret;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
}
- ret = SWFDisplayItem_get_ySkew(item);
- RETURN_DOUBLE(ret);
+ RETURN_DOUBLE(SWFFont_getDescent(getFont(getThis() TSRMLS_CC)));
}
/* }}} */
-/* {{{ swfdisplayitem_getRot */
-
-PHP_METHOD(swfdisplayitem, getRot)
+/* {{{ proto float swffont::getLeading()
+ Returns the leading of the font, or 0 if not available */
+PHP_METHOD(swffont, getLeading)
{
- float ret;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
}
- ret = SWFDisplayItem_get_rot(item);
- RETURN_DOUBLE(ret);
+ RETURN_DOUBLE(SWFFont_getLeading(getFont(getThis() TSRMLS_CC)));
}
/* }}} */
-#endif
-static const zend_function_entry swfdisplayitem_functions[] = {
- PHP_ME(swfdisplayitem, moveTo, NULL, 0)
- PHP_ME(swfdisplayitem, move, NULL, 0)
- PHP_ME(swfdisplayitem, scaleTo, NULL, 0)
- PHP_ME(swfdisplayitem, scale, NULL, 0)
- PHP_ME(swfdisplayitem, rotateTo, NULL, 0)
- PHP_ME(swfdisplayitem, rotate, NULL, 0)
- PHP_ME(swfdisplayitem, skewXTo, NULL, 0)
- PHP_ME(swfdisplayitem, skewX, NULL, 0)
- PHP_ME(swfdisplayitem, skewYTo, NULL, 0)
- PHP_ME(swfdisplayitem, skewY, NULL, 0)
- PHP_ME(swfdisplayitem, setMatrix, NULL, 0)
- PHP_ME(swfdisplayitem, setDepth, NULL, 0)
- PHP_ME(swfdisplayitem, setRatio, NULL, 0)
- PHP_ME(swfdisplayitem, addColor, NULL, 0)
- PHP_ME(swfdisplayitem, multColor, NULL, 0)
- PHP_ME(swfdisplayitem, setName, NULL, 0)
- PHP_ME(swfdisplayitem, addAction, NULL, 0)
+
+static zend_function_entry swffont_functions[] = {
+ PHP_ME(swffont, __construct, NULL, 0)
+ PHP_ME(swffont, getWidth, NULL, 0)
#ifdef HAVE_NEW_MING
- PHP_ME(swfdisplayitem, remove, NULL, 0)
- PHP_ME(swfdisplayitem, setMaskLevel,NULL, 0)
- PHP_ME(swfdisplayitem, endMask, NULL, 0)
- PHP_ME(swfdisplayitem, getX, NULL, 0)
- PHP_ME(swfdisplayitem, getY, NULL, 0)
- PHP_ME(swfdisplayitem, getXScale, NULL, 0)
- PHP_ME(swfdisplayitem, getYScale, NULL, 0)
- PHP_ME(swfdisplayitem, getXSkew, NULL, 0)
- PHP_ME(swfdisplayitem, getYSkew, NULL, 0)
- PHP_ME(swfdisplayitem, getRot, NULL, 0)
+ PHP_ME(swffont, getUTF8Width, NULL, 0)
+#endif
+ PHP_ME(swffont, getAscent, NULL, 0)
+ PHP_ME(swffont, getDescent, NULL, 0)
+ PHP_ME(swffont, getLeading, NULL, 0)
+#ifdef HAVE_NEW_MING
+ PHP_ME(swffont, getGlyphCount, NULL, 0)
+ PHP_ME(swffont, getName, NULL, 0)
#endif
{ NULL, NULL, NULL }
};
/* }}} */
-/* {{{ SWFFill
+
+/* {{{ SWFFilterMatrix
*/
-/* {{{ proto void swffill::__construct()
- Creates a new SWFFill object */
-PHP_METHOD(swffill, __construct)
-{
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Instantiating SWFFill won't do any good- use SWFShape::addFill() instead");
+/* {{{ proto void swffiltermatrix::__construct(cols, rows, array:vals)
+ Creates a new SWFFilterMatrix object */
+PHP_METHOD(swffiltermatrix, __construct)
+{
+ long cols, rows;
+ zval *vals, **data;
+ SWFFilterMatrix matrix;
+ HashTable *arr_hash;
+ int ret, items, i;
+ float *values;
+ HashPosition pointer;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lla", &cols, &rows, &vals) == FAILURE) {
+ return;
+ }
+
+ arr_hash = Z_ARRVAL_P(vals);
+ items = zend_hash_num_elements(arr_hash);
+ if(items != cols * rows)
+ {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Can't create FilterMatrix."
+ "Not enough / too many items it array");
+ }
+ values = (float *)malloc(items * sizeof(float));
+ for(i = 0, zend_hash_internal_pointer_reset_ex(arr_hash, &pointer);
+ zend_hash_get_current_data_ex(arr_hash, (void**) &data, &pointer) == SUCCESS;
+ zend_hash_move_forward_ex(arr_hash, &pointer), i++)
+ {
+ zval temp;
+ temp = **data;
+ zval_copy_ctor(&temp);
+ convert_to_double(&temp);
+ values[i] = Z_DVAL(temp);
+ zval_dtor(&temp);
+ }
+
+ matrix = newSWFFilterMatrix(cols, rows, values);
+ free(values); // array is copied by libming
+ ret = zend_list_insert(matrix, le_swffiltermatrixp);
+ object_init_ex(getThis(), filtermatrix_class_entry_ptr);
+ add_property_resource(getThis(), "filtermatrix", ret);
+ zend_list_addref(ret);
}
-static void destroy_SWFFill_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+static void destroy_SWFFilterMatrix_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
{
- /* this only destroys the shallow wrapper for SWFFillStyle,
- which SWFShape destroys. So everything's okay. I hope. */
-
- destroySWFFill((SWFFill)resource->ptr);
+ destroySWFFilterMatrix((SWFFilterMatrix)resource->ptr);
}
/* }}} */
-/* {{{ internal function getFill
- Returns the SWFFill object contained in zval *id */
-static SWFFill getFill(zval *id TSRMLS_DC)
+/* {{{ internal function getFilterMatrix
+ Returns the SWFFilterMatrix object contained in zval *id */
+static SWFFilterMatrix getFilterMatrix(zval *id TSRMLS_DC)
{
- void *fill = SWFgetProperty(id, "fill", 4, le_swffillp TSRMLS_CC);
+ void *matrix = SWFgetProperty(id, "filtermatrix", strlen("filtermatrix"), le_swffiltermatrixp TSRMLS_CC);
- if (!fill) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFFill");
+ if (!matrix) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFFilterMatrix");
}
- return (SWFFill)fill;
+ return (SWFFilterMatrix)matrix;
}
/* }}} */
+static zend_function_entry swffiltermatrix_functions[] = {
+ PHP_ME(swffiltermatrix, __construct, NULL, 0)
+ { NULL, NULL, NULL }
+};
+/* }}} */
-/* {{{ proto void swffill::moveTo(float x, float y)
- Moves this SWFFill to shape coordinates (x,y) */
-PHP_METHOD(swffill, moveTo)
+/* {{{ SWFShadow
+*/
+/* {{{ proto void swfshadow::__construct(angle, distance, strength)
+ Creates a new SWFShadow object */
+PHP_METHOD(swfshadow, __construct)
{
- double x, y;
+ double angle, distance, strength;
+ SWFShadow shadow;
+ int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &angle, &distance, &strength) == FAILURE) {
return;
}
- SWFFill_moveTo(getFill(getThis() TSRMLS_CC), (float)x, (float)y);
+ shadow = newSWFShadow(angle, distance, strength);
+ ret = zend_list_insert(shadow, le_swfshadowp);
+ object_init_ex(getThis(), shadow_class_entry_ptr);
+ add_property_resource(getThis(), "shadow", ret);
+ zend_list_addref(ret);
}
-/* }}} */
-/* {{{ proto void swffill::scaleTo(float xScale [, float yScale])
- Scales this SWFFill by xScale in the x direction, yScale in the y, or both to xScale if only one arg */
-PHP_METHOD(swffill, scaleTo)
+static void destroy_SWFShadow_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
{
- double x, y;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|d", &x, &y) == FAILURE) {
- return;
- }
-
- SWFFill_scaleXYTo(getFill(getThis() TSRMLS_CC), (float)x, (float)(argc == 1 ? x : y));
+ destroySWFShadow((SWFShadow)resource->ptr);
}
/* }}} */
-/* {{{ proto void swffill::rotateTo(float degrees)
- Rotates this SWFFill the given (clockwise) degrees from its original orientation */
-PHP_METHOD(swffill, rotateTo)
+/* {{{ internal function getShadow
+ Returns the SWFShadow object contained in zval *id */
+static SWFShadow getShadow(zval *id TSRMLS_DC)
{
- double degrees;
+ void *shadow = SWFgetProperty(id, "shadow", strlen("shadow"), le_swfshadowp TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
- return;
+ if (!shadow) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFShadow");
}
-
- SWFFill_rotateTo(getFill(getThis() TSRMLS_CC), (float)degrees);
+ return (SWFShadow)shadow;
}
/* }}} */
+static zend_function_entry swfshadow_functions[] = {
+ PHP_ME(swfshadow, __construct, NULL, 0)
+ { NULL, NULL, NULL }
+};
+/* }}} */
-/* {{{ proto void swffill::skewXTo(float xSkew)
- Sets this SWFFill's x skew value to xSkew */
-PHP_METHOD(swffill, skewXTo)
+/* {{{ SWFBlur
+*/
+/* {{{ proto void swfblur::__construct(blurX, blurY, passes)
+ Creates a new SWFBlur object */
+PHP_METHOD(swfblur, __construct)
{
- double x;
+ double blurX, blurY;
+ long passes;
+ SWFBlur blur;
+ int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &blurX, &blurY, &passes) == FAILURE) {
return;
}
- SWFFill_skewXTo(getFill(getThis() TSRMLS_CC), (float)x);
+ blur = newSWFBlur(blurX, blurY, passes);
+ ret = zend_list_insert(blur, le_swfblurp);
+ object_init_ex(getThis(), blur_class_entry_ptr);
+ add_property_resource(getThis(), "blur", ret);
+ zend_list_addref(ret);
+}
+
+static void destroy_SWFBlur_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+{
+ destroySWFBlur((SWFBlur)resource->ptr);
}
/* }}} */
-/* {{{ proto void swffill::skewYTo(float ySkew)
- Sets this SWFFill's y skew value to ySkew */
-PHP_METHOD(swffill, skewYTo)
+/* {{{ internal function getBlur
+ Returns the SWFBlur object contained in zval *id */
+static SWFBlur getBlur(zval *id TSRMLS_DC)
{
- double y;
+ void *blur = SWFgetProperty(id, "blur", strlen("blur"), le_swfblurp TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
- return;
+ if (!blur) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFBlur");
}
-
- SWFFill_skewYTo(getFill(getThis() TSRMLS_CC), (float)y);
+ return (SWFBlur)blur;
}
/* }}} */
-static const zend_function_entry swffill_functions[] = {
- PHP_ME(swffill, __construct, NULL, 0)
- PHP_ME(swffill, moveTo, NULL, 0)
- PHP_ME(swffill, scaleTo, NULL, 0)
- PHP_ME(swffill, rotateTo, NULL, 0)
- PHP_ME(swffill, skewXTo, NULL, 0)
- PHP_ME(swffill, skewYTo, NULL, 0)
+static zend_function_entry swfblur_functions[] = {
+ PHP_ME(swfblur, __construct, NULL, 0)
{ NULL, NULL, NULL }
};
-
/* }}} */
-/* {{{ SWFFontCharacter */
-#ifdef HAVE_NEW_MING
-/* {{{ internal function SWFText getFont(zval *id)
- Returns the Font object in zval *id */
-static
-SWFFontCharacter getFontCharacter(zval *id TSRMLS_DC)
+/* {{{ SWFGradient
+*/
+/* {{{ proto void swfgradient::__construct()
+ Creates a new SWFGradient object */
+PHP_METHOD(swfgradient, __construct)
{
- void *font = SWFgetProperty(id, "fontcharacter", 13, le_swffontcharp TSRMLS_CC);
+ SWFGradient gradient = newSWFGradient();
+ int ret = zend_list_insert(gradient, le_swfgradientp);
- if(!font)
- php_error(E_RECOVERABLE_ERROR, "called object is not an SWFFontCharacter!");
+ object_init_ex(getThis(), gradient_class_entry_ptr);
+ add_property_resource(getThis(), "gradient", ret);
+ zend_list_addref(ret);
+}
- return (SWFFontCharacter)font;
+static void destroy_SWFGradient_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+{
+ destroySWFGradient((SWFGradient)resource->ptr);
}
/* }}} */
-static void destroy_SWFFontCharacter_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+/* {{{ internal function getGradient
+ Returns the SWFGradient object contained in zval *id */
+static SWFGradient getGradient(zval *id TSRMLS_DC)
{
- destroySWFBlock((SWFBlock)resource->ptr);
+ void *gradient = SWFgetProperty(id, "gradient", 8, le_swfgradientp TSRMLS_CC);
+
+ if (!gradient) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFGradient");
+ }
+ return (SWFGradient)gradient;
}
+/* }}} */
-/* {{{ proto void swffontcha::raddChars(string)
- adds characters to a font for exporting font */
-PHP_METHOD(swffontchar, addChars)
+/* {{{ proto void swfgradient::addEntry(float ratio, int r, int g, int b [, int a])
+ Adds given entry to the gradient */
+PHP_METHOD(swfgradient, addEntry)
{
- char *zstring;
- int zstring_len;
+ double ratio;
+ long r, g, b, a = 0xff;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dlll|l", &ratio, &r, &g, &b, &a) == FAILURE) {
return;
}
- SWFFontCharacter_addChars(getFontCharacter(getThis() TSRMLS_CC), zstring);
+ SWFGradient_addEntry( getGradient(getThis() TSRMLS_CC), ratio, (byte)r, (byte)g, (byte)b, (byte)a);
}
/* }}} */
-/* {{{ proto void swffontchar::addChars(string)
- adds characters to a font for exporting font */
-
-PHP_METHOD(swffontchar, addUTF8Chars)
+/* {{{ proto void swfgradient::setSpreadMode(mode)
+ supported mode values:
+ * SWF_GRADIENT_PAD
+ * SWF_GRADIENT_REFLECT
+ * SWF_GRADIENT_REPEAT
+*/
+PHP_METHOD(swfgradient, setSpreadMode)
{
- char *zstring;
- int zstring_len;
+ long val;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) {
return;
}
- SWFFontCharacter_addUTF8Chars(getFontCharacter(getThis() TSRMLS_CC), zstring);
+ SWFGradient_setSpreadMode(getGradient(getThis() TSRMLS_CC), val);
}
/* }}} */
-static const zend_function_entry swffontchar_functions[] = {
- PHP_ME(swffontchar, addChars, NULL, 0)
- PHP_ME(swffontchar, addUTF8Chars, NULL, 0)
- { NULL, NULL, NULL }
-};
-
-#endif
-/* }}} */
-
-/* {{{ SWFFont
+/* {{{ proto void swfgradient::setInterpolationMode(mode)
+ * supported mode values:
+ * SWF_GRADIENT_NORMAL
+ * SWF_GRADIENT_LINEAR
*/
-/* {{{ internal function SWFText getFont(zval *id)
- Returns the Font object in zval *id */
-static SWFFont getFont(zval *id TSRMLS_DC)
+PHP_METHOD(swfgradient, setInterpolationMode)
{
- void *font = SWFgetProperty(id, "font", 4, le_swffontp TSRMLS_CC);
+ long val;
- if (!font) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFFont");
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) {
+ return;
}
- return (SWFFont)font;
+
+ SWFGradient_setInterpolationMode(getGradient(getThis() TSRMLS_CC), val);
}
/* }}} */
-/* {{{ proto void swffont::__construct(string filename)
- Creates a new SWFFont object from given file */
-PHP_METHOD(swffont, __construct)
+/* {{{ proto void swfgradient::setFocalPoint(mode) */
+PHP_METHOD(swfgradient, setFocalPoint)
{
- char *zfile;
- int zfile_len, ret;
- SWFFont font;
+ long val;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zfile, &zfile_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) {
return;
}
- if (strcmp(zfile + zfile_len - 4, ".fdb") == 0) {
- php_stream * stream;
- FILE * file;
-
- stream = php_stream_open_wrapper(zfile, "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
+ SWFGradient_setFocalPoint(getGradient(getThis() TSRMLS_CC), val);
+}
+/* }}} */
- if (stream == NULL) {
- RETURN_FALSE;
- }
+static zend_function_entry swfgradient_functions[] = {
+ PHP_ME(swfgradient, __construct, NULL, 0)
+ PHP_ME(swfgradient, addEntry, NULL, 0)
+ PHP_ME(swfgradient, setSpreadMode, NULL, 0)
+ PHP_ME(swfgradient, setInterpolationMode, NULL, 0)
+ PHP_ME(swfgradient, setFocalPoint, NULL, 0)
+ { NULL, NULL, NULL }
+};
+/* }}} */
- if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&file, REPORT_ERRORS)) {
- php_stream_close(stream);
- RETURN_FALSE;
- }
+/* {{{ SWFFilter
+*/
+
+/* helper functions */
+static SWFColor hashToColor(zval **colorHash)
+{
+ zval **data;
+ HashPosition pointer;
+ HashTable *arr_hash;
+ SWFColor c;
+
+ c.alpha = 0xff;
+ c.red = 0;
+ c.green = 0;
+ c.blue = 0;
- font = loadSWFFontFromFile(file);
- php_stream_close(stream);
- } else {
- PHP_MING_FILE_CHK(zfile);
- font = (SWFFont)newSWFBrowserFont(zfile);
+ arr_hash = Z_ARRVAL_PP(colorHash);
+ if(zend_hash_num_elements(arr_hash) < 3 || zend_hash_num_elements(arr_hash) > 4)
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "not a valid colorHash\n");
+
+ for(zend_hash_internal_pointer_reset_ex(arr_hash, &pointer);
+ zend_hash_get_current_data_ex(arr_hash, (void**) &data, &pointer) == SUCCESS;
+ zend_hash_move_forward_ex(arr_hash, &pointer))
+ {
+ zval temp;
+ char *key;
+ unsigned int key_len;
+ unsigned long index;
+
+ temp = **data;
+ if (zend_hash_get_current_key_ex(arr_hash, &key, &key_len, &index, 0, &pointer)
+ == HASH_KEY_IS_STRING)
+ {
+ zval_copy_ctor(&temp);
+ convert_to_long(&temp);
+ if(strcmp(key, "red") == 0)
+ c.red = Z_LVAL(temp);
+ else if (strcmp(key, "green") == 0)
+ c.green = Z_LVAL(temp);
+ else if (strcmp(key, "blue") == 0)
+ c.blue = Z_LVAL(temp);
+ else if (strcmp(key, "alpha") == 0)
+ c.alpha = Z_LVAL(temp);
+ else
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "not a valid colorHash\n");
+
+ zval_dtor(&temp);
+ }
}
+ return c;
+}
+
+static SWFFilter createDropShadowFilter(int argc, zval **argv[])
+{
+ zval **colorHash, **blur, **shadow, **flags;
+ SWFColor c;
+
+ if(argc != 5)
+ return NULL;
+
+ colorHash = argv[1];
+ convert_to_array_ex(colorHash);
+ c = hashToColor(colorHash);
+
+ blur = argv[2];
+ convert_to_object_ex(blur);
+
+ shadow = argv[3];
+ convert_to_object_ex(shadow);
- ret = zend_list_insert(font, le_swffontp);
+ flags = argv[4];
+ convert_to_long_ex(flags);
- object_init_ex(getThis(), font_class_entry_ptr);
- add_property_resource(getThis(), "font", ret);
- zend_list_addref(ret);
+ return newDropShadowFilter(c, getBlur(*blur TSRMLS_CC),
+ getShadow(*shadow TSRMLS_CC), Z_LVAL_PP(flags));
}
-static void destroy_SWFFont_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+static SWFFilter createBlurFilter(int argc, zval **argv[])
{
- destroySWFBlock((SWFBlock)resource->ptr);
+ zval **blur;
+
+ if(argc != 2)
+ return NULL;
+
+ blur = argv[1];
+ convert_to_object_ex(blur);
+
+ return newBlurFilter(getBlur(*blur TSRMLS_CC));
}
-/* }}} */
-/* {{{ proto float swffont::getWidth(string str)
- Calculates the width of the given string in this font at full height */
-PHP_METHOD(swffont, getWidth)
+static SWFFilter createGlowFilter(int argc, zval **argv[])
{
- char *zstring;
- int zstring_len;
- float width;
+ zval **color, **blur, **strength, **flags;
+ SWFColor c;
+
+ if(argc != 5)
+ return NULL;
+
+ color = argv[1];
+ convert_to_array_ex(color);
+ c = hashToColor(color);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
- return;
- }
+ blur = argv[2];
+ convert_to_object_ex(blur);
- width = SWFFont_getStringWidth(getFont(getThis() TSRMLS_CC), zstring);
- RETURN_DOUBLE(width);
-}
-/* }}} */
+ strength = argv[3];
+ convert_to_double_ex(strength);
+
+ flags = argv[4];
+ convert_to_long_ex(flags);
-#ifdef HAVE_NEW_MING
-/* {{{ proto int swffont::getUTF8Width(string)
- Calculates the width of the given string in this font at full height */
+ return newGlowFilter(c, getBlur(*blur TSRMLS_CC),
+ Z_DVAL_PP(strength), Z_LVAL_PP(flags));
+}
-PHP_METHOD(swffont, getUTF8Width)
+static SWFFilter createBevelFilter(int argc, zval **argv[])
{
- char *zstring;
- int zstring_len;
- float width;
+ zval **sColor, **hColor, **blur, **shadow, **flags;
+ SWFColor hc, sc;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
- return;
- }
+ if(argc != 6)
+ return NULL;
- width = SWFFont_getUTF8StringWidth(getFont(getThis() TSRMLS_CC), zstring);
+ sColor = argv[1];
+ convert_to_array_ex(sColor);
+ sc = hashToColor(sColor);
- RETURN_DOUBLE(width);
+ hColor = argv[2];
+ convert_to_array_ex(hColor);
+ hc = hashToColor(hColor);
+
+ blur = argv[3];
+ convert_to_object_ex(blur);
+
+ shadow = argv[4];
+ convert_to_object_ex(shadow);
+
+ flags = argv[5];
+ convert_to_long_ex(flags);
+
+ return newBevelFilter(sc, hc, getBlur(*blur TSRMLS_CC),
+ getShadow(*shadow TSRMLS_CC), Z_LVAL_PP(flags));
}
-/* }}} */
-/* not sure about 0 bytes !!!!!!!!! */
-/* {{{ proto int swffont::getWideWidth(string)
- Calculates the width of the given string in this font at full height */
-/*
-PHP_METHOD(swffont, getWideWidth)
+static SWFFilter createGradientGlowFilter(int argc, zval **argv[])
{
- char *zstring;
- int zstring_len;
- float width;
+ zval **gradient, **blur, **shadow, **flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
- return;
- }
+ if(argc != 5)
+ return NULL;
- width = SWFFont_getWideStringWidth(getFont(getThis() TSRMLS_CC), zstring);
+ gradient = argv[1];
+ convert_to_object_ex(gradient);
- RETURN_DOUBLE(width);
-}
-*/
-/* }}} */
-#endif
+ blur = argv[2];
+ convert_to_object_ex(blur);
+
+ shadow = argv[3];
+ convert_to_object_ex(shadow);
-/* {{{ proto float swffont::getAscent()
- Returns the ascent of the font, or 0 if not available */
-PHP_METHOD(swffont, getAscent)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- RETURN_DOUBLE(SWFFont_getAscent(getFont(getThis() TSRMLS_CC)));
-}
-/* }}} */
+ flags = argv[4];
+ convert_to_long_ex(flags);
-/* {{{ proto float swffont::getDescent()
- Returns the descent of the font, or 0 if not available */
-PHP_METHOD(swffont, getDescent)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- RETURN_DOUBLE(SWFFont_getDescent(getFont(getThis() TSRMLS_CC)));
+ return newGradientGlowFilter(getGradient(*gradient TSRMLS_CC),
+ getBlur(*blur TSRMLS_CC), getShadow(*shadow TSRMLS_CC),
+ Z_LVAL_PP(flags));
}
-/* }}} */
-/* {{{ proto float swffont::getLeading()
- Returns the leading of the font, or 0 if not available */
-PHP_METHOD(swffont, getLeading)
+static SWFFilter createConvolutionFilter(int argc, zval **argv[])
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- RETURN_DOUBLE(SWFFont_getLeading(getFont(getThis() TSRMLS_CC)));
-}
-/* }}} */
+ zval **matrix, **div, **bias, **color, **flags;
+ SWFColor c;
-#ifdef HAVE_NEW_MING
-/* {{{ proto void swffont::addChars(string)
- adds characters to a font required within textfields */
-/*
-PHP_METHOD(swffont, addChars)
-{
- char *zstring;
- int zstring_len;
+ if(argc != 6)
+ return NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
- return;
- }
+ matrix = argv[1];
+ convert_to_object_ex(matrix);
- SWFFont_addChars(getFont(getThis() TSRMLS_CC), zstring);
+ div = argv[2];
+ convert_to_double_ex(div);
+
+ bias = argv[3];
+ convert_to_double_ex(bias);
+
+ color = argv[4];
+ convert_to_array_ex(color);
+ c = hashToColor(color);
+
+ flags = argv[5];
+ convert_to_long_ex(flags);
+
+ return newConvolutionFilter(getFilterMatrix(*matrix TSRMLS_CC), Z_DVAL_PP(div),
+ Z_DVAL_PP(bias), c, Z_LVAL_PP(flags));
}
-*/
-/* }}} */
-/* {{{ proto string swffont::getShape(int code)
- Returns the glyph shape of a char as a text string */
-PHP_METHOD(swffont, getShape)
+static SWFFilter createColorMatrixFilter(int argc, zval **argv[])
{
- long zcode;
- char *result;
+ zval **matrix;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zcode) == FAILURE) {
- return;
- }
+ if(argc != 2)
+ return NULL;
+
+ matrix = argv[1];
+ convert_to_object_ex(matrix);
- result = SWFFont_getShape(getFont(getThis() TSRMLS_CC), zcode);
- RETVAL_STRING(result, 1);
- free(result);
+ return newColorMatrixFilter(getFilterMatrix(*matrix TSRMLS_CC));
}
-/* }}} */
-#endif
+static SWFFilter createGradientBevelFilter(int argc, zval **argv[])
+{
+ zval **gradient, **blur, **shadow, **flags;
-static const zend_function_entry swffont_functions[] = {
- PHP_ME(swffont, __construct, NULL, 0)
- PHP_ME(swffont, getWidth, NULL, 0)
-#ifdef HAVE_NEW_MING
- PHP_ME(swffont, getUTF8Width, NULL, 0)
-/* PHP_ME(swffont, getwidewidth, NULL, 0)*/
-#endif
- PHP_ME(swffont, getAscent, NULL, 0)
- PHP_ME(swffont, getDescent, NULL, 0)
- PHP_ME(swffont, getLeading, NULL, 0)
-#ifdef HAVE_NEW_MING
-/* PHP_ME(swffont, addchars, NULL, 0)*/
- PHP_ME(swffont, getShape, NULL, 0)
-#endif
- { NULL, NULL, NULL }
-};
+ if(argc != 5)
+ return NULL;
-/* }}} */
+ gradient = argv[1];
+ convert_to_object_ex(gradient);
-/* {{{ SWFGradient
+ blur = argv[2];
+ convert_to_object_ex(blur);
+
+ shadow = argv[3];
+ convert_to_object_ex(shadow);
+
+ flags = argv[4];
+ convert_to_long_ex(flags);
+
+ return newGradientBevelFilter(getGradient(*gradient TSRMLS_CC),
+ getBlur(*blur TSRMLS_CC), getShadow(*shadow TSRMLS_CC),
+ Z_LVAL_PP(flags));
+}
+
+/* {{{ proto void swffilter::__construct(type, ...)
+ Creates a new SWFFilter object:
+
+ Supported filter types:
+ * SWFFILTER_TYPE_DROPSHADOW
+ new SWFFilter(SWFFILTER_TYPE_DROPSHADOW, colorHash, blur, shadow, flags);
+ * SWFFILTER_TYPE_BLUR
+ new SWFFilter(SWFFILTER_TYPE_BLUR, blur);
+ * SWFFILTER_TYPE_GLOW
+ new SWFFilter(SWFFILTER_TYPE_GLOW, colorHash, blur, strenght:float, flags);
+ * SWFFILTER_TYPE_BEVEL
+ new SWFFilter(SWFFILTER_TYPE_BEVEL, colorHash_shadow, colorHash_highlight, blur, shadow, flags);
+ * SWFFILTER_TYPE_GRADIENTGLOW
+ new SWFFilter(SWFFILTER_TYPE_GRADIENTGLOW, gradient, blur, shadow, flags);
+ * SWFFILTER_TYPE_CONVOLUTION
+ new SWFFilter(SWFFILTER_TYPE_CONVOLUTION, filterMatrix, divisor:float, bias:float, colorHash, flags);
+ * SWFFILTER_TYPE_COLORMATRIX
+ new SWFFilter(SWFFILTER_TYPE_COLORMATRIX, filterMatrix);
+ * SWFFILTER_TYPE_GRADIENTBEVEL
+ new SWFFilter(SWFFILTER_TYPE_GRADIENTBEVEL, gradient, blur, shadow, flags);
+
+ Supported flags are:
+ * SWFFILTER_FLAG_CLAMP
+ * SWFFILTER_FLAG_PRESERVE_ALPHA
+ * SWFFILTER_MODE_INNER
+ * SWFFILTER_MODE_KO
+
+ A colorHash must have the following entries:
+ 'red' => 0...255,
+ 'green' => 0...255,
+ 'blue' => 0...255,
+ 'alpha' => 0...255 (optional)
*/
-/* {{{ proto void swfgradient::__construct()
- Creates a new SWFGradient object */
-PHP_METHOD(swfgradient, __construct)
+PHP_METHOD(swffilter, __construct)
{
- SWFGradient gradient = newSWFGradient();
- int ret = zend_list_insert(gradient, le_swfgradientp);
+ zval **argv[6];
+ int argc = ZEND_NUM_ARGS();
+ int type, ret;
+ SWFFilter filter = NULL;
+
+ if (argc > 6 || argc < 2 || zend_get_parameters_array_ex(argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
+
- object_init_ex(getThis(), gradient_class_entry_ptr);
- add_property_resource(getThis(), "gradient", ret);
- zend_list_addref(ret);
-}
+ convert_to_long_ex(argv[0]);
+ type = Z_LVAL_PP(argv[0]);
+ switch(type)
+ {
+ case SWFFILTER_TYPE_DROPSHADOW:
+ filter = createDropShadowFilter(argc, argv);
+ break;
+ case SWFFILTER_TYPE_BLUR:
+ filter = createBlurFilter(argc, argv);
+ break;
+ case SWFFILTER_TYPE_GLOW:
+ filter = createGlowFilter(argc, argv);
+ break;
+ case SWFFILTER_TYPE_BEVEL:
+ filter = createBevelFilter(argc, argv);
+ break;
+ case SWFFILTER_TYPE_GRADIENTGLOW:
+ filter = createGradientGlowFilter(argc, argv);
+ break;
+ case SWFFILTER_TYPE_CONVOLUTION:
+ filter = createConvolutionFilter(argc, argv);
+ break;
+ case SWFFILTER_TYPE_COLORMATRIX:
+ filter = createColorMatrixFilter(argc, argv);
+ break;
+ case SWFFILTER_TYPE_GRADIENTBEVEL:
+ filter = createGradientBevelFilter(argc, argv);
+ break;
+ default:
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "new SWFFilter: unknown type");
+ }
+
+ if(filter == NULL)
+ WRONG_PARAM_COUNT;
-static void destroy_SWFGradient_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFGradient((SWFGradient)resource->ptr);
+ ret = zend_list_insert(filter, le_swffilterp);
+ object_init_ex(getThis(), filter_class_entry_ptr);
+ add_property_resource(getThis(), "filter", ret);
+ zend_list_addref(ret);
}
/* }}} */
-/* {{{ internal function getGradient
- Returns the SWFGradient object contained in zval *id */
-static SWFGradient getGradient(zval *id TSRMLS_DC)
+/* {{{ internal function getFilter
+ Returns the SWFFilter object contained in zval *id */
+static SWFFilter getFilter(zval *id TSRMLS_DC)
{
- void *gradient = SWFgetProperty(id, "gradient", 8, le_swfgradientp TSRMLS_CC);
+ void *filter = SWFgetProperty(id, "filter",
+ strlen("filter"), le_swffilterp TSRMLS_CC);
- if (!gradient) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFGradient");
+ if (!filter) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFFilter");
}
- return (SWFGradient)gradient;
+ return (SWFFilter)filter;
}
/* }}} */
-/* {{{ proto void swfgradient::addEntry(float ratio, int r, int g, int b [, int a])
- Adds given entry to the gradient */
-PHP_METHOD(swfgradient, addEntry)
+static void destroy_SWFFilter_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
{
- double ratio;
- long r, g, b, a = 0xff;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dlll|l", &ratio, &r, &g, &b, &a) == FAILURE) {
- return;
- }
-
- SWFGradient_addEntry(getGradient(getThis() TSRMLS_CC), (byte)ratio, (byte)r, (byte)g, (byte)b, (byte)a);
+ destroySWFFilter((SWFFilter)resource->ptr);
}
-/* }}} */
-static const zend_function_entry swfgradient_functions[] = {
- PHP_ME(swfgradient, __construct, NULL, 0)
- PHP_ME(swfgradient, addEntry, NULL, 0)
+static zend_function_entry swffilter_functions[] = {
+ PHP_ME(swffilter, __construct, NULL, 0)
{ NULL, NULL, NULL }
};
-
/* }}} */
+
+
/* {{{ SWFMorph
*/
/* {{{ proto void swfmorph::__construct()
void *morph = SWFgetProperty(id, "morph", 5, le_swfmorphp TSRMLS_CC);
if (!morph) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFMorph");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFMorph");
}
return (SWFMorph)morph;
}
}
/* }}} */
-static const zend_function_entry swfmorph_functions[] = {
+static zend_function_entry swfmorph_functions[] = {
PHP_ME(swfmorph, __construct, NULL, 0)
PHP_ME(swfmorph, getShape1, NULL, 0)
PHP_ME(swfmorph, getShape2, NULL, 0)
/* }}} */
+/* {{{ SWFSoundStream
+ */
+
+/* {{{ proto class soundstream::init(file) */
+PHP_METHOD(swfsoundstream, __construct)
+{
+ zval *zfile;
+ SWFSoundStream sound = NULL;
+ SWFInput input = NULL;
+ int ret;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zfile) == FAILURE) {
+ return;
+ }
+
+ switch(Z_TYPE_P(zfile))
+ {
+ case IS_RESOURCE:
+ input = getInput_fromFileResource(zfile TSRMLS_CC);
+ break;
+ case IS_OBJECT:
+ input = getInput(zfile TSRMLS_CC);
+ break;
+ case IS_STRING:
+ input = newSWFInput_filename(Z_STRVAL_P(zfile));
+ if(input == NULL)
+ php_error(E_ERROR, "opening sound file failed");
+ zend_list_addref(zend_list_insert(input, le_swfinputp));
+ break;
+
+ default:
+ php_error(E_ERROR, "soundstream::init: need either a filename, "
+ "a file ressource or SWFInput buffer.");
+ }
+
+ sound = newSWFSoundStream_fromInput(input);
+
+ if(sound) {
+ ret = zend_list_insert(sound, le_swfsoundstreamp);
+ object_init_ex(getThis(), soundstream_class_entry_ptr);
+ add_property_resource(getThis(), "soundstream", ret);
+ zend_list_addref(ret);
+ }
+}
+/* }}} */
+
+/* {{{ internal function getSoundStream
+ Returns the SWFSoundStream object contained in zval *id */
+static SWFSoundStream getSoundStream(zval *id TSRMLS_DC)
+{
+ void *sound = SWFgetProperty(id, "soundstream", strlen("soundstream"),
+ le_swfsoundstreamp TSRMLS_CC);
+ if(!sound)
+ php_error(E_ERROR, "called object is not an SWFSoundStream!");
+ return (SWFSoundStream)sound;
+}
+/* }}} */
+
+/* {{{ internal function destroy_SWFSoundStream */
+static void destroy_SWFSoundStream_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+{
+ destroySWFSoundStream((SWFSoundStream)resource->ptr);
+}
+/* }}} */
+
+/* {{{
+ returns the duration of the sound stream */
+PHP_METHOD(swfsoundstream, getDuration)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ RETURN_LONG(SWFSoundStream_getDuration(getSoundStream(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+
+static zend_function_entry swfsoundstream_functions[] = {
+ PHP_ME(swfsoundstream, __construct, NULL, 0)
+ PHP_ME(swfsoundstream, getDuration, NULL, 0)
+ { NULL, NULL, NULL }
+};
+/* }}} */
+
+
+
/* {{{ SWFSound */
/* {{{ internal function SWFSound getSound(zval *id)
Returns the Sound object in zval *id */
void *sound = SWFgetProperty(id, "sound", 5, le_swfsoundp TSRMLS_CC);
if(!sound)
- php_error(E_RECOVERABLE_ERROR, "called object is not an SWFSound!");
+ php_error(E_ERROR, "called object is not an SWFSound!");
return (SWFSound)sound;
}
/* }}} */
-/* {{{ proto void swfsound::__construct(mixed filename [, int flags])
- Creates a new SWFSound object from given file */
+/* {{{ proto void swfsound::__construct(string filename/SWFInput/SWFSoundstream[, int flags])
+ Creates a new SWFSound object from given file
+ Takes either a Filename or SWFInput memory buffer AND flags or
+ a SWFSoundStream object with NO flags.
+*/
PHP_METHOD(swfsound, __construct)
{
- zval **zfile;
- long zflags = 0;
- SWFSound sound;
- SWFInput input;
- int flags;
+ zval *zfile;
+ long flags;
+ SWFSound sound = NULL;
+ SWFInput input = NULL;
+ SWFSoundStream stream;
int ret;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|l", &zfile, &zflags) == FAILURE) {
- return;
- }
- if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
- convert_to_string_ex(zfile);
- PHP_MING_FILE_CHK(Z_STRVAL_PP(zfile));
- input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- } else {
- input = getInput(zfile TSRMLS_CC);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &zfile, &flags) == FAILURE) {
+ return;
}
- flags = zflags;
-
-#ifdef HAVE_NEW_MING
- sound = newSWFSound_fromInput(input, flags);
-#else
- sound = newSWFSound_fromInput(input);
-#endif
+ if(ZEND_NUM_ARGS() == 1)
+ {
+ stream = getSoundStream(zfile TSRMLS_CC);
+ sound = newSWFSound_fromSoundStream(stream);
+ }
+ else if(ZEND_NUM_ARGS() == 2)
+ {
+ switch(Z_TYPE_P(zfile))
+ {
+ case IS_RESOURCE:
+ input = getInput_fromFileResource(zfile TSRMLS_CC);
+ break;
+ case IS_OBJECT:
+ input = getInput(zfile TSRMLS_CC);
+ break;
+ case IS_STRING:
+ input = newSWFInput_filename(Z_STRVAL_P(zfile));
+ if(input == NULL)
+ php_error(E_ERROR, "opening sound file failed");
+ zend_list_addref(zend_list_insert(input, le_swfinputp));
+ break;
- ret = zend_list_insert(sound, le_swfsoundp);
+ default:
+ php_error(E_ERROR, "swfsound::__construct: need either a filename, "
+ "a file ressource or SWFInput buffer.");
+ }
+ sound = newSWFSound_fromInput(input, flags);
+ }
- object_init_ex(getThis(), sound_class_entry_ptr);
- add_property_resource(getThis(), "sound", ret);
- zend_list_addref(ret);
+ if(sound != NULL)
+ {
+ ret = zend_list_insert(sound, le_swfsoundp);
+ object_init_ex(getThis(), sound_class_entry_ptr);
+ add_property_resource(getThis(), "sound", ret);
+ zend_list_addref(ret);
+ }
}
static void destroy_SWFSound_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
/* }}} */
-static const zend_function_entry swfsound_functions[] = {
+static zend_function_entry swfsound_functions[] = {
PHP_ME(swfsound, __construct, NULL, 0)
{ NULL, NULL, NULL }
};
void *inst = SWFgetProperty(id, "soundinstance", 13, le_swfsoundinstancep TSRMLS_CC);
if (!inst)
- php_error(E_RECOVERABLE_ERROR, "called object is not an SWFSoundInstance!");
+ php_error(E_ERROR, "called object is not an SWFSoundInstance!");
return (SWFSoundInstance)inst;
}
{
SWFSoundInstance inst = getSoundInstance(getThis() TSRMLS_CC);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ if(ZEND_NUM_ARGS() != 0)
+ WRONG_PARAM_COUNT;
+
SWFSoundInstance_setNoMultiple(inst);
}
/* }}} */
-/* {{{ swfsoundinstance_loopinpoint(int point) */
+/* {{{ swfsoundinstance_loopinpoint(point) */
PHP_METHOD(swfsoundinstance, loopInPoint)
{
- long zpoint;
+ long point;
+
SWFSoundInstance inst = getSoundInstance(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zpoint) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &point) == FAILURE) {
return;
}
- SWFSoundInstance_setLoopInPoint(inst, zpoint);
+ SWFSoundInstance_setLoopInPoint(inst, point);
}
/* }}} */
PHP_METHOD(swfsoundinstance, loopOutPoint)
{
- long zpoint;
+ long point;
+
SWFSoundInstance inst = getSoundInstance(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zpoint) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &point) == FAILURE) {
return;
}
- SWFSoundInstance_setLoopOutPoint(inst, zpoint);
+ SWFSoundInstance_setLoopOutPoint(inst, point);
}
/* }}} */
PHP_METHOD(swfsoundinstance, loopCount)
{
- long zcount;
+ long count;
SWFSoundInstance inst = getSoundInstance(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zcount) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &count) == FAILURE) {
return;
}
- SWFSoundInstance_setLoopCount(inst, zcount);
+ SWFSoundInstance_setLoopCount(inst, count);
}
/* }}} */
-static const zend_function_entry swfsoundinstance_functions[] = {
+static zend_function_entry swfsoundinstance_functions[] = {
PHP_ME(swfsoundinstance, noMultiple, NULL, 0)
PHP_ME(swfsoundinstance, loopInPoint, NULL, 0)
PHP_ME(swfsoundinstance, loopOutPoint, NULL, 0)
/* {{{ SWFVideoStream */
-/* {{{ proto class swfvideostream_init([mixed file])
+/* {{{ proto class swfvideostream_init([filename])
Returns a SWVideoStream object */
-
PHP_METHOD(swfvideostream, __construct)
{
- zval **zfile = NULL;
+ zval *zfile = NULL;
SWFVideoStream stream;
- SWFInput input;
+ SWFInput input = NULL;
int ret;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|Z", &zfile) == FAILURE) {
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &zfile) == FAILURE) {
return;
}
+ switch(ZEND_NUM_ARGS())
+ {
+ case 1:
- if (zfile) {
- if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
- convert_to_string_ex(zfile);
- input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- } else {
+ switch(Z_TYPE_P(zfile))
+ {
+ case IS_RESOURCE:
+ input = getInput_fromFileResource(zfile TSRMLS_CC);
+ break;
+ case IS_OBJECT:
input = getInput(zfile TSRMLS_CC);
+ break;
+ case IS_STRING:
+ input = newSWFInput_filename(Z_STRVAL_P(zfile));
+ if(input == NULL)
+ php_error(E_ERROR, "opening sound video failed");
+ zend_list_addref(zend_list_insert(input, le_swfinputp));
+ break;
+
+ default:
+ php_error(E_ERROR, "swfvideostream_init: need either a filename, "
+ "a file ressource or SWFInput buffer.");
}
stream = newSWFVideoStream_fromInput(input);
- } else {
+ break;
+ case 0:
stream = newSWFVideoStream();
+ break;
}
-
- if (stream) {
+
+ if(stream) {
ret = zend_list_insert(stream, le_swfvideostreamp);
object_init_ex(getThis(), videostream_class_entry_ptr);
add_property_resource(getThis(), "videostream", ret);
zend_list_addref(ret);
- }
+ }
}
static void destroy_SWFVideoStream_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
/* {{{ internal function getVideoStream
Returns the SWFVideoStream object contained in zval *id */
-
static SWFVideoStream getVideoStream(zval *id TSRMLS_DC)
{
void *stream = SWFgetProperty(id, "videostream", 11, le_swfvideostreamp TSRMLS_CC);
-
if(!stream)
- php_error(E_RECOVERABLE_ERROR, "called object is not an SWFVideoStream!");
-
+ php_error(E_ERROR, "called object is not an SWFVideoStream!");
return (SWFVideoStream)stream;
}
{
long x, y;
SWFVideoStream stream = getVideoStream(getThis() TSRMLS_CC);
-
- if (!stream) {
- php_error(E_RECOVERABLE_ERROR, "getVideoSTream returned NULL");
- }
+ if(!stream)
+ php_error(E_ERROR, "getVideoStream returned NULL");
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x, &y) == FAILURE) {
return;
/* {{{ getNumFrames */
PHP_METHOD(swfvideostream, getnumframes)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
}
+
RETURN_LONG(SWFVideoStream_getNumFrames(getVideoStream(getThis() TSRMLS_CC)));
}
/* }}} */
+
+/* {{{ hasAudio */
+PHP_METHOD(swfvideostream, hasaudio)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ RETURN_LONG(SWFVideoStream_hasAudio(getVideoStream(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
-static const zend_function_entry swfvideostream_functions[] = {
+static zend_function_entry swfvideostream_functions[] = {
PHP_ME(swfvideostream, __construct, NULL, 0)
PHP_ME(swfvideostream, setdimension, NULL, 0)
PHP_ME(swfvideostream, getnumframes, NULL, 0)
+ PHP_ME(swfvideostream, hasaudio, NULL, 0)
{ NULL, NULL, NULL }
};
/* }}} */
-#endif
-#ifdef HAVE_SWFPREBUILTCLIP
+/* {{{ SWFBinaryData
+ */
+
+/* {{{ proto class swfbinarydata_init(string)
+ Returns a SWFBinaryData object */
+PHP_METHOD(swfbinarydata, __construct)
+{
+ char *data;
+ long data_len;
+ SWFBinaryData bd = NULL;
+ int ret;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) {
+ return;
+ }
+ bd = newSWFBinaryData((unsigned char *)data, data_len);
+
+ if(bd) {
+ ret = zend_list_insert(bd, le_swfbinarydatap);
+ object_init_ex(getThis(), binarydata_class_entry_ptr);
+ add_property_resource(getThis(), "binarydata", ret);
+ zend_list_addref(ret);
+ }
+}
+/* }}} */
+
+/* {{{ internal function getBinaryData
+ Returns the SWFBinaryData object contained in zval *id */
+static inline SWFBinaryData getBinaryData(zval *id TSRMLS_DC)
+{
+ void *bd = SWFgetProperty(id, "binarydata", strlen("binarydata"), le_swfbinarydatap TSRMLS_CC);
+ if(!bd)
+ php_error(E_ERROR, "called object is not an SWFBinaryData!");
+ return (SWFBinaryData)bd;
+}
+/* }}} */
+
+/* {{{ internal function destroy_SWFBinaryData */
+static void destroy_SWFBinaryData_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
+{
+ destroySWFBinaryData((SWFBinaryData)resource->ptr);
+}
+/* }}} */
+
+static zend_function_entry swfbinarydata_functions[] = {
+ PHP_ME(swfbinarydata, __construct, NULL, 0)
+ { NULL, NULL, NULL }
+};
+/* }}} */
+
/* {{{ SWFPrebuiltClip */
-/* {{{ proto class swfprebuiltclip_init(mixed file)
+/* {{{ proto class swfprebuiltclip_init(filename / SWFInput )
Returns a SWFPrebuiltClip object */
-
PHP_METHOD(swfprebuiltclip, __construct)
{
- zval **zfile = NULL;
+ zval *zfile = NULL;
SWFPrebuiltClip clip;
- SWFInput input;
+ SWFInput input = NULL;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &zfile) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zfile) == FAILURE) {
+ return;
+ }
+
+ switch(Z_TYPE_P(zfile))
+ {
+ case IS_RESOURCE:
+ input = getInput_fromFileResource(zfile TSRMLS_CC);
+ break;
+ case IS_OBJECT:
+ input = getInput(zfile TSRMLS_CC);
+ break;
+ case IS_STRING:
+ input = newSWFInput_filename(Z_STRVAL_P(zfile));
+ if(input == NULL)
+ php_error(E_ERROR, "opening prebuilt clip file failed");
+ zend_list_addref(zend_list_insert(input, le_swfinputp));
+ break;
+
+ default:
+ php_error(E_ERROR, "swfprebuiltclip_init: need either a filename, "
+ "a file ressource or SWFInput buffer.");
}
-
-/* not sure whether this makes sense
- there would have to be a function to add contents
- case 0:
- clip = newSWFPrebuiltClip();
- break; */
-
- if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
- convert_to_string_ex(zfile);
- input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- } else {
- input = getInput(zfile TSRMLS_CC);
- }
-
+
clip = newSWFPrebuiltClip_fromInput(input);
- if (clip) {
+ if(clip) {
ret = zend_list_insert(clip, le_swfprebuiltclipp);
object_init_ex(getThis(), prebuiltclip_class_entry_ptr);
add_property_resource(getThis(), "prebuiltclip", ret);
/* {{{ internal function getPrebuiltClip
Returns the SWFPrebuiltClip object contained in zval *id */
-
static SWFPrebuiltClip getPrebuiltClip(zval *id TSRMLS_DC)
{
void *clip = SWFgetProperty(id, "prebuiltclip", 12, le_swfprebuiltclipp TSRMLS_CC);
-
if(!clip)
- php_error(E_RECOVERABLE_ERROR, "called object is not an SWFPrebuiltClip!");
-
+ php_error(E_ERROR, "called object is not an SWFPrebuiltClip!");
return (SWFPrebuiltClip)clip;
}
-
/* }}} */
-static const zend_function_entry swfprebuiltclip_functions[] = {
+
+static zend_function_entry swfprebuiltclip_functions[] = {
PHP_ME(swfprebuiltclip, __construct, NULL, 0)
{ NULL, NULL, NULL }
};
/* }}} */
#endif
-/* }}} */
-
/* {{{ SWFMovie
*/
-/* {{{ proto void swfmovie::__construct([int version])
+/* {{{ proto void swfmovie::__construct(int version)
Creates swfmovie object according to the passed version */
PHP_METHOD(swfmovie, __construct)
{
long version;
SWFMovie movie;
- int ret, argc = ZEND_NUM_ARGS();
+ int ret;
- if (zend_parse_parameters(argc TSRMLS_CC, "|l", &version) == FAILURE) {
- return;
- }
-
- if (argc) {
+ if (ZEND_NUM_ARGS() == 1) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &version) == FAILURE) {
+ return;
+ }
movie = newSWFMovieWithVersion(version);
} else {
movie = newSWFMovie(); /* default version 4 */
void *movie = SWFgetProperty(id, "movie", 5, le_swfmoviep TSRMLS_CC);
if (!movie) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFMovie");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFMovie");
}
return (SWFMovie)movie;
}
PHP_METHOD(swfmovie, labelFrame)
{
char *label;
- int label_len;
+ long label_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &label, &label_len) == FAILURE) {
return;
}
/* }}} */
-#ifdef HAVE_SWFMOVIE_NAMEDANCHOR
-/* {{{ proto void swfmovie::namedanchor(string name)
+/* {{{ proto void swfmovie::namedanchor()
*/
PHP_METHOD(swfmovie, namedAnchor)
{
- char *name;
- int name_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ char *label;
+ long label_len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &label, &label_len) == FAILURE) {
return;
}
-
- SWFMovie_namedAnchor(getMovie(getThis() TSRMLS_CC), name);
+
+ SWFMovie_namedAnchor(getMovie(getThis() TSRMLS_CC), label);
}
/* }}} */
-#endif
/* {{{ proto void swfmovie::protect([ string pasword])
*/
PHP_METHOD(swfmovie, protect)
{
- char *zchar = NULL;
- int zchar_len, argc = ZEND_NUM_ARGS();
+ char *passwd = NULL;
+ long passwd_len;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters(argc TSRMLS_CC, "|s", &zchar, &zchar_len) == FAILURE) {
- return;
- }
- if (argc) {
- SWFMovie_protect(movie, zchar);
- } else {
- SWFMovie_protect(movie, NULL);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &passwd, &passwd_len) == FAILURE) {
+ return;
}
+ SWFMovie_protect(movie, passwd);
}
/* }}} */
-
/* {{{ proto object swfmovie::add(object SWFBlock)
*/
PHP_METHOD(swfmovie, add)
/* XXX - SWFMovie_add deals w/ all block types. Probably will need to add that.. */
if (Z_OBJCE_P(zchar) == action_class_entry_ptr) {
block = (SWFBlock) getAction(zchar TSRMLS_CC);
- } else {
+ }
+ else if(Z_OBJCE_P(zchar) == character_class_entry_ptr) {
+ block = (SWFBlock) getCharacterClass(zchar TSRMLS_CC);
+ }
+ else {
block = (SWFBlock) getCharacter(zchar TSRMLS_CC);
}
- item = SWFMovie_add(movie, block);
-
+ item = SWFMovie_add_internal(movie, (SWFMovieBlockType)block);
if (item != NULL) {
/* try and create a displayitem object */
ret = zend_list_insert(item, le_swfdisplayitemp);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
return;
}
-
item = getDisplayItem(zchar TSRMLS_CC);
SWFMovie_remove(movie, item);
}
PHP_METHOD(swfmovie, output)
{
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
- long zlimit;
+#if !defined(HAVE_NEW_MING)
int limit = -1;
- int argc = ZEND_NUM_ARGS();
int oldval = INT_MIN;
long out;
- if (zend_parse_parameters(argc TSRMLS_CC, "|l", &zlimit) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &limit) == FAILURE) {
return;
}
-
- if (argc) {
- limit = zlimit;
-
- if ((limit < 0) || (limit > 9)) {
- php_error(E_WARNING, "compression level must be within 0..9");
- RETURN_FALSE;
- }
- }
-
oldval = Ming_setSWFCompression(limit);
out = SWFMovie_output(movie, &phpByteOutputMethod, NULL);
-
- if (oldval >= -1 && oldval <= 9) {
- Ming_setSWFCompression(oldval);
- }
+ Ming_setSWFCompression(oldval);
+
RETURN_LONG(out);
#elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL)
- long zlimit;
int limit = -1;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "|l", &zlimit) == FAILURE) {
- return;
- }
-
- if (argc) {
- limit = zlimit;
+ if(argc) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &limit) == FAILURE) {
+ return;
+ }
if ((limit < 0) || (limit > 9)) {
- php_error(E_WARNING, "compression level must be within 0..9");
+ php_error(E_WARNING,"compression level must be within 0..9");
RETURN_FALSE;
}
}
*/
PHP_METHOD(swfmovie, saveToFile)
{
- zval **x;
-#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
- zval **zlimit = NULL;
+ zval *x;
+ long zlimit = 0;
int limit = -1;
-#endif
-#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
+#if !defined(HAVE_NEW_MING)
int oldval = INT_MIN;
- long out;
#endif
+ long out;
+
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
php_stream *what;
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &x) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 2:
-#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
- if (zend_get_parameters_ex(2, &x, &zlimit) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(zlimit);
- limit = Z_LVAL_PP(zlimit);
- if ((limit < 0) || (limit > 9)) {
- php_error(E_WARNING,"compression level must be within 0..9");
- RETURN_FALSE;
- }
-#endif
-#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &x, &limit) == FAILURE) {
+ return;
+ }
+
+ if ((limit < 0) || (limit > 9)) {
+ php_error(E_WARNING,"compression level must be within 0..9");
+ RETURN_FALSE;
+ }
+#if !defined(HAVE_NEW_MING)
oldval = Ming_setSWFCompression(limit);
#endif
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(what, php_stream *, x, -1,"File-Handle",php_file_le_stream());
-#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
+ ZEND_FETCH_RESOURCE(what, php_stream *, &x, -1,"File-Handle",php_file_le_stream());
+#if !defined(HAVE_NEW_MING)
out = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, what);
- if (oldval >= -1 && oldval <=9)
- Ming_setSWFCompression(oldval);
- RETURN_LONG(out);
+ Ming_setSWFCompression(oldval);
#elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL)
- RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what, limit));
+ out = SWFMovie_output(movie, &phpStreamOutputMethod, what, limit);
#else
- RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what));
+ out = SWFMovie_output(movie, &phpStreamOutputMethod, what);
#endif
+ RETURN_LONG(out);
}
/* }}} */
Saves the movie. 'where' can be stream and the movie will be saved there otherwise it is treated as string and written in file with that name */
PHP_METHOD(swfmovie, save)
{
- zval **x;
-#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
- zval **zlimit = NULL;
+ zval *x, *zlimit = NULL;
int limit = -1;
-#endif
-#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
+#if !defined(HAVE_NEW_MING)
int oldval = INT_MIN;
#endif
long retval;
php_stream *stream;
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
-#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
- if (zend_get_parameters_ex(2, &x, &zlimit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(zlimit);
- limit = Z_LVAL_PP(zlimit);
- if ((limit < 0) || (limit > 9)) {
- php_error(E_WARNING,"compression level must be within 0..9");
- RETURN_FALSE;
- }
-#endif
-#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &x, &limit) == FAILURE) {
+ return;
+ }
+
+#if !defined(HAVE_NEW_MING)
oldval = Ming_setSWFCompression(limit);
#endif
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(x) == IS_RESOURCE) {
- ZEND_FETCH_RESOURCE(stream, php_stream *, x, -1,"File-Handle",php_file_le_stream());
+ if (Z_TYPE_P(x) == IS_RESOURCE) {
+ ZEND_FETCH_RESOURCE(stream, php_stream *, &x, -1,"File-Handle",php_file_le_stream());
#if defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL)
RETURN_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream, limit));
#else
RETVAL_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream));
-#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
- if(oldval >= -1 && oldval <=9)
+#if !defined(HAVE_NEW_MING)
Ming_setSWFCompression(oldval);
#endif
return;
#endif
}
- convert_to_string_ex(x);
- stream = php_stream_open_wrapper(Z_STRVAL_PP(x), "wb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
+ convert_to_string(x);
+ stream = php_stream_open_wrapper(Z_STRVAL_P(x), "wb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
if (stream == NULL) {
RETURN_FALSE;
retval = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, (void *)stream);
#endif
php_stream_close(stream);
-#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
- if(oldval >= -1 && oldval <=9)
- Ming_setSWFCompression(oldval);
+#if!defined(HAVE_NEW_MING)
+ Ming_setSWFCompression(oldval);
#endif
RETURN_LONG(retval);
return;
}
- SWFMovie_setRate(movie, (float)rate);
+ SWFMovie_setRate(movie, rate);
}
/* }}} */
return;
}
- SWFMovie_setDimension(movie, (float)x, (float)y);
+ SWFMovie_setDimension(movie, x, y);
}
/* }}} */
/* }}} */
#ifdef HAVE_NEW_MING
-/* {{{ proto int swfmovie::streamMP3(mixed file [, float skip])
- Sets sound stream of the SWF movie. The parameter can be stream or string. Retuens the number of frames. */
+/* {{{ proto void swfmovie::addMetadata(string xml)
+ * */
+PHP_METHOD(swfmovie, addMetadata)
+{
+ char *xml;
+ long xml_len;
+
+ SWFMovie movie = getMovie(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &xml, &xml_len) == FAILURE) {
+ return;
+ }
+
+ SWFMovie_addMetadata(movie, xml);
+}
+/* }}} */
+
+/* {{{ proto void swfmovie::setScriptLimits(int maxRecursion, int timeout)
+*/
+PHP_METHOD(swfmovie, setScriptLimits)
+{
+ long maxRecursion, timeout;
+ SWFMovie movie = getMovie(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &maxRecursion, &timeout) == FAILURE) {
+ return;
+ }
+
+ SWFMovie_setScriptLimits(movie, maxRecursion, timeout);
+}
+/* }}} */
+
+/* {{{ proto void swfmovie::setTabIndex(int depth, int index)
+ * */
+PHP_METHOD(swfmovie, setTabIndex)
+{
+ long depth, index;
+ SWFMovie movie = getMovie(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &depth, &index) == FAILURE) {
+ return;
+ }
+
+ SWFMovie_setTabIndex(movie, depth, index);
+}
+/* }}} */
+
+/* {{{ proto void swfmovie::assignSymbol(SWFCharacter character, string name)
+ * */
+PHP_METHOD(swfmovie, assignSymbol)
+{
+ zval *zchar;
+ char *name;
+ long name_len;
+ SWFCharacter character;
+ SWFMovie movie = getMovie(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os", &zchar, &name, &name_len) == FAILURE) {
+ return;
+ }
+
+ character = getCharacter(zchar TSRMLS_CC);
+ SWFMovie_assignSymbol(movie, character, name);
+}
+/* }}} */
+
+/* {{{ proto void swfmovie::defineScene(int offset, string name)
+ * */
+PHP_METHOD(swfmovie, defineScene)
+{
+ long offset;
+ char *name;
+ long name_len;
+ SWFMovie movie = getMovie(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &offset, &name, &name_len) == FAILURE) {
+ return;
+ }
+
+ SWFMovie_defineScene(movie, offset, name);
+}
+/* }}} */
+
+/* {{{ proto void swfmovie::setNetworkAccess(int flag)
+ * */
+PHP_METHOD(swfmovie, setNetworkAccess)
+{
+ long flag;
+ SWFMovie movie = getMovie(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flag) == FAILURE) {
+ return;
+ }
+
+ SWFMovie_setNetworkAccess(movie, flag);
+}
+/* }}} */
+
+/* {{{ proto long swfmovie::streamMP3(mixed filename / SWFInput [, double skip])
+ Sets sound stream of the SWF movie. The parameter can be stream or string. */
PHP_METHOD(swfmovie, streamMP3)
{
- zval **zfile;
+ zval *zfile;
double skip = 0;
SWFSoundStream sound;
- SWFInput input;
+ SWFInput input = NULL;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|d", &zfile, &skip) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|d", &zfile, &skip) == FAILURE) {
return;
}
-
- if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
- convert_to_string_ex(zfile);
- input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- } else {
+
+ switch(Z_TYPE_P(zfile))
+ {
+ case IS_RESOURCE:
+ input = getInput_fromFileResource(zfile TSRMLS_CC);
+ break;
+ case IS_OBJECT:
input = getInput(zfile TSRMLS_CC);
+ break;
+ case IS_STRING:
+ input = newSWFInput_filename(Z_STRVAL_P(zfile));
+ if (input == NULL) {
+ php_error(E_ERROR, "opening mp3 file failed");
+ }
+
+ zend_list_addref(zend_list_insert(input, le_swfinputp));
+ break;
+
+ default:
+ php_error(E_ERROR, "swfmovie::streamMP3: need either a filename, "
+ "a file ressource or SWFInput buffer.");
}
-
+
sound = newSWFSoundStream_fromInput(input);
- SWFMovie_setSoundStreamAt(movie, sound, (float)skip);
- RETURN_LONG(SWFSoundStream_getFrames(sound));
+ SWFMovie_setSoundStreamAt(movie, sound, skip);
+ RETURN_LONG(SWFSoundStream_getDuration(sound) / SWFMovie_getRate(movie));
+}
+/* }}} */
+
+/* {{{ proto long swfmovie::setSoundStream
+ Sets sound stream of the SWF movie. The parameter must be a SoundStream object */
+PHP_METHOD(swfmovie, setSoundStream)
+{
+ zval *zstream;
+ double skip = 0;
+ SWFSoundStream sound;
+ SWFMovie movie = getMovie(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|d", &zstream, &skip) == FAILURE) {
+ return;
+ }
+
+ sound = getSoundStream(zstream TSRMLS_CC);
+ SWFMovie_setSoundStreamAt(movie, sound, skip);
+ RETURN_LONG(SWFSoundStream_getDuration(sound) / SWFMovie_getRate(movie));
}
/* }}} */
PHP_METHOD(swfmovie, addExport)
{
zval *zchar;
- char *zname;
- int zname_len;
+ char *name;
+ long name_len;
SWFBlock block;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os", &zchar, &zname, &zname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os", &zchar, &name, &name_len) == FAILURE) {
return;
}
block = (SWFBlock)getCharacter(zchar TSRMLS_CC);
- SWFMovie_addExport(movie, block, zname);
+ SWFMovie_addExport(movie, block, name);
}
/* }}} */
item = SWFMovie_startSound(movie, sound);
- if (item != NULL) {
+ if(item != NULL)
+ {
/* try and create a soundinstance object */
ret = zend_list_insert(item, le_swfsoundinstancep);
object_init_ex(return_value, soundinstance_class_entry_ptr);
}
/* }}} */
-/* {{{ void swfmovie_stopsound */
-
+/* {{{ void swfmovie::stopsound(sound) */
PHP_METHOD(swfmovie, stopSound)
{
zval *zsound;
}
/* }}} */
-/* {{{ void swfmovie_importChar */
-
+/* {{{ void swfmovie::importChar(filename, importname) */
PHP_METHOD(swfmovie, importChar)
{
SWFMovie movie;
- SWFCharacter res;
+ SWFCharacter character;
int ret;
char *libswf, *name;
- int libswf_len, name_len;
+ long libswf_len, name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &libswf, &libswf_len, &name, &name_len) == FAILURE) {
return;
}
-
- movie = getMovie(getThis() TSRMLS_CC);
- res = SWFMovie_importCharacter(movie, libswf, name);
- if (res != NULL) {
- /* try and create a sprite object */
- ret = zend_list_insert(res, le_swfspritep);
- object_init_ex(return_value, sprite_class_entry_ptr);
- add_property_resource(return_value, "sprite", ret);
+ movie = getMovie(getThis() TSRMLS_CC);
+ character = SWFMovie_importCharacter(movie, libswf, name);
+ if(character != NULL)
+ {
+ ret = zend_list_insert(character, le_swfcharacterp);
+ object_init_ex(return_value, character_class_entry_ptr);
+ add_property_resource(return_value, "character", ret);
zend_list_addref(ret);
- }
+ }
}
/* }}} */
/* {{{ void swfmovie_importFont */
-
PHP_METHOD(swfmovie, importFont)
{
SWFMovie movie;
SWFFontCharacter res;
int ret;
char *libswf, *name;
- int libswf_len, name_len;
+ long libswf_len, name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &libswf, &libswf_len, &name, &name_len) == FAILURE) {
return;
}
-
+
movie = getMovie(getThis() TSRMLS_CC);
PHP_MING_FILE_CHK(libswf);
res = SWFMovie_importFont(movie, libswf, name);
- if (res != NULL) {
+ if(res != NULL)
+ {
/* try and create a fontchar object */
- ret = zend_list_insert(res, le_swffontcharp);
+ ret = zend_list_insert(res, le_swffontcharp);
object_init_ex(return_value, fontchar_class_entry_ptr);
add_property_resource(return_value, "fontcharacter", ret);
zend_list_addref(ret);
movie = getMovie(getThis() TSRMLS_CC);
font = getFont(zfont TSRMLS_CC);
res = SWFMovie_addFont(movie, font);
-
- if (res != NULL) {
+ if(res != NULL)
+ {
/* try and create a fontchar object */
- ret = zend_list_insert(res, le_swffontcharp);
+ ret = zend_list_insert(res, le_swffontcharp);
object_init_ex(return_value, fontchar_class_entry_ptr);
add_property_resource(return_value, "fontcharacter", ret);
zend_list_addref(ret);
}
}
/* }}} */
+
+/* {{{ void swfmovie_replace */
+PHP_METHOD(swfmovie, replace)
+{
+ SWFMovie movie;
+ zval *zitem, **zblock;
+ SWFDisplayItem item;
+ SWFBlock block;
+ SWFMovieBlockType ublock;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oo", &zitem, &zblock) == FAILURE) {
+ return;
+ }
+
+ item = getDisplayItem(zitem TSRMLS_CC);
+
+ block = (SWFBlock) getCharacter(*zblock TSRMLS_CC);
+ movie = getMovie(getThis() TSRMLS_CC);
+ ublock.block = block;
+
+ SWFMovie_replace_internal(movie, item, ublock);
+}
+/* }}} */
+
+/* {{{ float swfmovie::getRate() */
+PHP_METHOD(swfmovie, getRate)
+{
+ RETURN_DOUBLE(SWFMovie_getRate(getMovie(getThis() TSRMLS_CC)));
+}
+/* }}} */
#endif
-static const zend_function_entry swfmovie_functions[] = {
+static zend_function_entry swfmovie_functions[] = {
PHP_ME(swfmovie, __construct, NULL, 0)
PHP_ME(swfmovie, nextFrame, NULL, 0)
PHP_ME(swfmovie, labelFrame, NULL, 0)
PHP_ME(swfmovie, setFrames, NULL, 0)
#ifdef HAVE_NEW_MING
PHP_ME(swfmovie, streamMP3, NULL, 0)
+ PHP_ME(swfmovie, setSoundStream, NULL, 0)
PHP_ME(swfmovie, addExport, NULL, 0)
PHP_ME(swfmovie, writeExports, NULL, 0)
PHP_ME(swfmovie, startSound, NULL, 0)
PHP_ME(swfmovie, importFont, NULL, 0)
PHP_ME(swfmovie, addFont, NULL, 0)
PHP_ME(swfmovie, protect, NULL, 0)
-#endif
-#ifdef HAVE_SWFMOVIE_NAMEDANCHOR
- PHP_ME(swfmovie, namedAnchor, NULL, 0)
+ PHP_ME(swfmovie, addMetadata, NULL, 0)
+ PHP_ME(swfmovie, setNetworkAccess, NULL, 0)
+ PHP_ME(swfmovie, setScriptLimits, NULL, 0)
+ PHP_ME(swfmovie, setTabIndex, NULL, 0)
+ PHP_ME(swfmovie, assignSymbol, NULL, 0)
+ PHP_ME(swfmovie, defineScene, NULL, 0)
+ PHP_ME(swfmovie, namedAnchor, NULL, 0)
+ PHP_ME(swfmovie, replace, NULL, 0)
+ PHP_ME(swfmovie, getRate, NULL, 0)
#endif
{ NULL, NULL, NULL }
};
{
SWFShape shape = newSWFShape();
int ret = zend_list_insert(shape, le_swfshapep);
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
object_init_ex(getThis(), shape_class_entry_ptr);
add_property_resource(getThis(), "shape", ret);
void *shape = SWFgetProperty(id, "shape", 5, le_swfshapep TSRMLS_CC);
if (!shape) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFShape");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFShape");
}
return (SWFShape)shape;
Sets the current line style for this SWFShape */
PHP_METHOD(swfshape, setLine)
{
- zval **w, **r, **g, **b, **a;
+ long w, r, g, b, a = 0xff;
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &w, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 5) {
- if (zend_get_parameters_ex(5, &w, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(a);
- } else if (ZEND_NUM_ARGS() == 1) {
- SWFShape_setLine(getShape(getThis() TSRMLS_CC), 0, 0, 0, 0, 0);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll|l", &w, &r, &g, &b, &a) == FAILURE) {
return;
- } else {
- WRONG_PARAM_COUNT;
}
- convert_to_long_ex(w);
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- if (ZEND_NUM_ARGS() == 4) {
- SWFShape_setLine(getShape(getThis() TSRMLS_CC),
- (unsigned short)Z_LVAL_PP(w), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff
- );
- } else {
- SWFShape_setLine(getShape(getThis() TSRMLS_CC),
- (unsigned short)Z_LVAL_PP(w), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a)
- );
- }
+ SWFShape_setLine(getShape(getThis() TSRMLS_CC), (unsigned short)w, (byte)r, (byte)g, (byte)b, (byte)a);
}
/* }}} */
if (ZEND_NUM_ARGS() == 1 || ZEND_NUM_ARGS() == 2) {
/* it's a gradient or bitmap */
- zval **arg1;
+ zval *arg1;
unsigned char flags = 0;
- if (ZEND_NUM_ARGS() == 2) {
- zval **arg2;
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- flags = (unsigned char)Z_LVAL_PP(arg2);
- } else {
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|l", &arg1, &flags) == FAILURE) {
+ return;
}
- convert_to_object_ex(arg1);
-
- if (Z_OBJCE_PP(arg1) == gradient_class_entry_ptr) {
+ if (Z_OBJCE_P(arg1) == gradient_class_entry_ptr) {
if (flags == 0) {
flags = SWFFILL_LINEAR_GRADIENT;
}
- fill = SWFShape_addGradientFill(getShape(getThis() TSRMLS_CC), getGradient(*arg1 TSRMLS_CC), flags);
- } else if (Z_OBJCE_PP(arg1) == bitmap_class_entry_ptr) {
+ fill = SWFShape_addGradientFill(getShape(getThis() TSRMLS_CC), getGradient(arg1 TSRMLS_CC), flags);
+ } else if (Z_OBJCE_P(arg1) == bitmap_class_entry_ptr) {
if (flags == 0) {
flags = SWFFILL_TILED_BITMAP;
}
- fill = SWFShape_addBitmapFill(getShape(getThis() TSRMLS_CC), getBitmap(*arg1 TSRMLS_CC), flags);
+ fill = SWFShape_addBitmapFill(getShape(getThis() TSRMLS_CC), getBitmap(arg1 TSRMLS_CC), flags);
} else {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Argument is not a bitmap nor a gradient");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Argument is not a bitmap nor a gradient");
}
} else if (ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4) {
/* it's a solid fill */
- zval **r, **g, **b, **za;
- byte a = 0xff;
+ long r, g, b, a = 0xff;
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &za) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(za);
- a = BYTE_Z_LVAL_PP(za);
- } else {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &r, &g, &b, &a) == FAILURE) {
+ return;
}
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC),
- BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), a
- );
+ fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC), (byte)r, (byte)g, (byte)b, (byte)a);
} else {
WRONG_PARAM_COUNT;
}
if (!fill) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Error adding fill to shape");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error adding fill to shape");
}
/* return an SWFFill object */
Sets the left side fill style to fill in case only one parameter is passed. When 3 or 4 parameters are passed they are treated as : int r, int g, int b, int a . Solid fill is performed in this case before setting left side fill type. */
PHP_METHOD(swfshape, setLeftFill)
{
- zval **zfill, **r, **g, **b, **a;
+ zval *zfill;
+ long r, g, b, a = 0xff;
SWFFill fill;
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC),
- BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff
- );
-
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (ZEND_NUM_ARGS() == 1) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zfill) == FAILURE) {
+ return;
}
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- convert_to_long_ex(a);
-
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC),
- BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a)
- );
-
- } else if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &zfill) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_LVAL_PP(zfill) != 0) {
- convert_to_object_ex(zfill);
- fill = getFill(*zfill TSRMLS_CC);
- } else {
- fill = NULL;
+ fill = getFill(zfill TSRMLS_CC);
+ }
+ else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &r, &g, &b, &a) == FAILURE) {
+ return;
}
- } else {
- WRONG_PARAM_COUNT;
+ fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC), (byte)r, (byte)g, (byte)b, (byte)a);
}
SWFShape_setLeftFill(getShape(getThis() TSRMLS_CC), fill);
Sets the right side fill style to fill in case only one parameter is passed. When 3 or 4 parameters are passed they are treated as : int r, int g, int b, int a . Solid fill is performed in this case before setting right side fill type. */
PHP_METHOD(swfshape, setRightFill)
{
- zval **zfill, **r, **g, **b, **a;
+ zval *zfill;
+ long r, g, b, a = 0xff;
SWFFill fill;
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC),
- BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff
- );
-
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (ZEND_NUM_ARGS() == 1) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zfill) == FAILURE) {
+ return;
}
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- convert_to_long_ex(a);
-
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC),
- BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a)
- );
- } else if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &zfill) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_LVAL_PP(zfill) != 0) {
- convert_to_object_ex(zfill);
- fill = getFill(*zfill TSRMLS_CC);
- } else {
- fill = NULL;
+ fill = getFill(zfill TSRMLS_CC);
+ }
+ else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &r, &g, &b, &a) == FAILURE) {
+ return;
}
- } else {
- WRONG_PARAM_COUNT;
+ fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC), (byte)r, (byte)g, (byte)b, (byte)a);
}
SWFShape_setRightFill(getShape(getThis() TSRMLS_CC), fill);
}
/* }}} */
-/* {{{ proto void swfshape::movepento(float x, float y)
+/* {{{ proto void swfshape::movepento(double x, double y)
Moves the pen to shape coordinates (x, y) */
PHP_METHOD(swfshape, movePenTo)
{
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
-
- SWFShape_movePenTo(getShape(getThis() TSRMLS_CC), (float)x, (float)y);
+
+ SWFShape_movePenTo(getShape(getThis() TSRMLS_CC), x, y);
}
/* }}} */
-/* {{{ proto void swfshape::movepen(float x, float y)
+/* {{{ proto void swfshape::movepen(double x, double y)
Moves the pen from its current location by vector (x, y) */
PHP_METHOD(swfshape, movePen)
{
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
-
- SWFShape_movePen(getShape(getThis() TSRMLS_CC), (float)x, (float)y);
+
+ SWFShape_movePen(getShape(getThis() TSRMLS_CC), x, y);
}
/* }}} */
-/* {{{ proto void swfshape::drawlineto(float x, float y)
+/* {{{ proto void swfshape::drawlineto(double x, double y)
Draws a line from the current pen position to shape coordinates (x, y) in the current line style */
PHP_METHOD(swfshape, drawLineTo)
{
return;
}
- SWFShape_drawLineTo(getShape(getThis() TSRMLS_CC), (float)x, (float)y);
+ SWFShape_drawLineTo(getShape(getThis() TSRMLS_CC), x, y);
}
/* }}} */
-/* {{{ proto void swfshape::drawline(float dx, float dy)
+/* {{{ proto void swfshape::drawline(double dx, double dy)
Draws a line from the current pen position (x, y) to the point (x+dx, y+dy) in the current line style */
PHP_METHOD(swfshape, drawLine)
{
return;
}
- SWFShape_drawLine(getShape(getThis() TSRMLS_CC), (float)x, (float)y);
+ SWFShape_drawLine(getShape(getThis() TSRMLS_CC), x, y);
}
/* }}} */
-/* {{{ proto void swfshape::drawcurveto(float ax, float ay, float bx, float by [, float dx, float dy])
+/* {{{ proto void swfshape::drawcurveto(double ax, double ay, double bx, double by [, double dx, double dy])
Draws a curve from the current pen position (x,y) to the point (bx, by) in the current line style, using point (ax, ay) as a control point. Or draws a cubic bezier to point (dx, dy) with control points (ax, ay) and (bx, by) */
PHP_METHOD(swfshape, drawCurveTo)
{
if (ZEND_NUM_ARGS() == 4) {
- zval **cx, **cy, **ax, **ay;
+ double cx, cy, ax, ay;
- if (zend_get_parameters_ex(4, &cx, &cy, &ax, &ay) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &cx, &cy, &ax, &ay) == FAILURE) {
+ return;
}
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(ax);
- convert_to_double_ex(ay);
-
- SWFShape_drawCurveTo(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(ax), FLOAT_Z_DVAL_PP(ay)
- );
-
+
+ SWFShape_drawCurveTo(getShape(getThis() TSRMLS_CC), cx, cy, ax, ay);
} else if (ZEND_NUM_ARGS() == 6) {
- zval **bx, **by, **cx, **cy, **dx, **dy;
+ double bx, by, cx, cy, dx, dy;
- if (zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
+ return;
}
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG(SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy))
- );
+
+ RETURN_LONG(SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC), bx, by, cx, cy, dx, dy));
} else {
WRONG_PARAM_COUNT;
}
}
/* }}} */
-/* {{{ proto void swfshape::drawcurve(float adx, float ady, float bdx, float bdy [, float cdx, float cdy])
+/* {{{ proto void swfshape::drawcurve(double adx, double ady, double bdx, double bdy [, double cdx, double cdy])
Draws a curve from the current pen position (x, y) to the point (x+bdx, y+bdy) in the current line style, using point (x+adx, y+ady) as a control point or draws a cubic bezier to point (x+cdx, x+cdy) with control points (x+adx, y+ady) and (x+bdx, y+bdy) */
PHP_METHOD(swfshape, drawCurve)
{
if (ZEND_NUM_ARGS() == 4) {
- zval **cx, **cy, **ax, **ay;
+ double cx, cy, ax, ay;
- if (zend_get_parameters_ex(4, &cx, &cy, &ax, &ay) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &cx, &cy, &ax, &ay) == FAILURE) {
+ return;
}
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(ax);
- convert_to_double_ex(ay);
-
- SWFShape_drawCurve(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(ax), FLOAT_Z_DVAL_PP(ay)
- );
+ SWFShape_drawCurve(getShape(getThis() TSRMLS_CC), cx, cy, ax, ay);
} else if (ZEND_NUM_ARGS() == 6) {
- zval **bx, **by, **cx, **cy, **dx, **dy;
+ double bx, by, cx, cy, dx, dy;
- if (zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
+ return;
}
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG( SWFShape_drawCubic(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy))
- );
+
+ RETURN_LONG(SWFShape_drawCubic(getShape(getThis() TSRMLS_CC), bx, by, cx, cy, dx, dy));
} else {
WRONG_PARAM_COUNT;
}
{
zval *font;
char *c;
- int c_len;
- long size = 1024. / Ming_getScale();
+ long c_len;
+ int size = (int)(1024.0f/Ming_getScale());
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os|l", &font, &c, &c_len, &size) == FAILURE) {
return;
}
-
- SWFShape_drawSizedGlyph(getShape(getThis() TSRMLS_CC), getFont(font TSRMLS_CC), c[0], (int)size);
+ SWFShape_drawSizedGlyph(getShape(getThis() TSRMLS_CC), getFont(font TSRMLS_CC), c[0], size);
}
/* }}} */
-/* {{{ proto void swfshape::drawcircle(float r)
+/* {{{ proto void swfshape::drawcircle(double r)
Draws a circle of radius r centered at the current location, in a counter-clockwise fashion */
PHP_METHOD(swfshape, drawCircle)
{
double r;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &r) == FAILURE) {
return;
}
- SWFShape_drawCircle(getShape(getThis() TSRMLS_CC), (float)r);
+ SWFShape_drawCircle(getShape(getThis() TSRMLS_CC), r);
}
/* }}} */
-/* {{{ proto void swfshape::drawarc(float r, float startAngle, float endAngle)
+/* {{{ proto void swfshape::drawarc(double r, double startAngle, double endAngle)
Draws an arc of radius r centered at the current location, from angle startAngle to angle endAngle measured clockwise from 12 o'clock */
PHP_METHOD(swfshape, drawArc)
{
}
/* convert angles to radians, since that's what php uses elsewhere */
- SWFShape_drawArc(getShape(getThis() TSRMLS_CC), (float)r, (float)start, (float)end);
+ SWFShape_drawArc(getShape(getThis() TSRMLS_CC), r, start, end);
}
/* }}} */
-/* {{{ proto void swfshape::drawcubic(float bx, float by, float cx, float cy, float dx, float dy)
+/* {{{ proto void swfshape::drawcubic(double bx, double by, double cx, double cy, double dx, double dy)
Draws a cubic bezier curve using the current position and the three given points as control points */
PHP_METHOD(swfshape, drawCubic)
{
return;
}
- RETURN_LONG(SWFShape_drawCubic(getShape(getThis() TSRMLS_CC), (float)bx, (float)by, (float)cx, (float)cy, (float)dx, (float)dy));
+ RETURN_LONG(SWFShape_drawCubic(getShape(getThis() TSRMLS_CC), bx, by, cx, cy, dx, dy));
}
/* }}} */
-/* {{{ proto void swfshape::drawcubic(float bx, float by, float cx, float cy, float dx, float dy)
+/* {{{ proto void swfshape::drawcubic(double bx, double by, double cx, double cy, double dx, double dy)
Draws a cubic bezier curve using the current position and the three given points as control points */
PHP_METHOD(swfshape, drawCubicTo)
{
return;
}
- RETURN_LONG(SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC), (float)bx, (float)by, (float)cx, (float)cy, (float)dx, (float)dy));
+ RETURN_LONG(SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC), bx, by, cx, cy, dx, dy));
+}
+/* }}} */
+
+/* {{{ proto void swfshape::end() */
+PHP_METHOD(swfshape, end)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFShape_end(getShape(getThis() TSRMLS_CC));
+}
+/* }}} */
+
+/* {{{ proto void swfshape::useVersion()
+ * SWF_SHAPE3
+ * SWF_SHAPE4
+ */
+PHP_METHOD(swfshape, useVersion)
+{
+ long ver;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ver) == FAILURE) {
+ return;
+ }
+
+ SWFShape_useVersion(getShape(getThis() TSRMLS_CC), ver);
+}
+/* }}} */
+
+/* {{{ proto int swfshape::getVersion() */
+PHP_METHOD(swfshape, getVersion)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ RETURN_LONG(SWFShape_getVersion(getShape(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+/* {{{ proto void swfshape::setRenderHintingFlags(flags)
+ * SWF_SHAPE_USESCALINGSTROKES
+ * SWF_SHAPE_USENONSCALINGSTROKES
+ */
+PHP_METHOD(swfshape, setRenderHintingFlags)
+{
+ long flags;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
+ return;
+ }
+
+ SWFShape_setRenderHintingFlags(getShape(getThis() TSRMLS_CC), flags);
+}
+/* }}} */
+
+/* {{{ proto double swfshape::getPenX() */
+PHP_METHOD(swfshape, getPenX)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ RETURN_DOUBLE(SWFShape_getPenX(getShape(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+/* {{{ proto double swfshape::getPenY() */
+PHP_METHOD(swfshape, getPenY)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ RETURN_DOUBLE(SWFShape_getPenY(getShape(getThis() TSRMLS_CC)));
+}
+/* }}} */
+
+/* {{{ proto void swfshape::hideLine() */
+PHP_METHOD(swfshape, hideLine)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFShape_hideLine(getShape(getThis() TSRMLS_CC));
+}
+/* }}} */
+
+/* {{{ proto void swfshape::drawCharacterBounds(character) */
+PHP_METHOD(swfshape, drawCharacterBounds)
+{
+ zval *character;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &character) == FAILURE) {
+ return;
+ }
+
+ SWFShape_drawCharacterBounds(getShape(getThis() TSRMLS_CC),
+ getCharacter(character TSRMLS_CC));
+}
+/* }}} */
+
+/* {{{ proto void swfshape::setLine2(width, flags, miterLimit, r, g, b, [a])
+ * Line cap style: select one of the following flags (default is round cap style)
+ * SWF_LINESTYLE_CAP_ROUND
+ * SWF_LINESTYLE_CAP_NONE
+ * SWF_LINESTYLE_CAP_SQUARE
+ *
+ * Line join style: select one of the following flags (default is round join style)
+ * SWF_LINESTYLE_JOIN_ROUND
+ * SWF_LINESTYLE_JOIN_BEVEL
+ * SWF_LINESTYLE_JOIN_MITER
+ *
+ * Scaling flags: disable horizontal / vertical scaling
+ * SWF_LINESTYLE_FLAG_NOHSCALE
+ * SWF_LINESTYLE_FLAG_NOVSCALE
+ *
+ * Enable pixel hinting to correct blurry vertical / horizontal lines
+ * -> all anchors will be aligned to full pixels
+ * SWF_LINESTYLE_FLAG_HINTING
+ *
+ * Disable stroke closure: if no-close flag is set caps will be applied
+ * instead of joins
+ * SWF_LINESTYLE_FLAG_NOCLOSE
+ *
+ * End-cap style: default round
+ * SWF_LINESTYLE_FLAG_ENDCAP_ROUND
+ * SWF_LINESTYLE_FLAG_ENDCAP_NONE
+ * SWF_LINESTYLE_FLAG_ENDCAP_SQUARE
+ *
+ * If join style is SWF_LINESTYLE_JOIN_MITER a miter limit factor
+ * must be set. Miter max length is then calculated as:
+ * max miter len = miter limit * width.
+ * If join style is not miter, this value will be ignored.
+ * */
+PHP_METHOD(swfshape, setLine2)
+{
+ long width, flags, r, g, b, a = 0xff;
+ double limit;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lldlll|l", &width, &flags, &limit, &r, &g, &b, &a) == FAILURE) {
+ return;
+ }
+
+ SWFShape_setLine2(getShape(getThis() TSRMLS_CC), width, r, g, b, a, flags, limit);
+}
+/* }}} */
+
+/* {{{ proto void swfshape::setLine2Filled(width, fill, flags, limit)
+ * Line cap style: select one of the following flags (default is round cap style)
+ * SWF_LINESTYLE_CAP_ROUND
+ * SWF_LINESTYLE_CAP_NONE
+ * SWF_LINESTYLE_CAP_SQUARE
+ *
+ * Line join style: select one of the following flags (default is round join style)
+ * SWF_LINESTYLE_JOIN_ROUND
+ * SWF_LINESTYLE_JOIN_BEVEL
+ * SWF_LINESTYLE_JOIN_MITER
+ *
+ * Scaling flags: disable horizontal / vertical scaling
+ * SWF_LINESTYLE_FLAG_NOHSCALE
+ * SWF_LINESTYLE_FLAG_NOVSCALE
+ *
+ * Enable pixel hinting to correct blurry vertical / horizontal lines
+ * -> all anchors will be aligned to full pixels
+ * SWF_LINESTYLE_FLAG_HINTING
+ *
+ * Disable stroke closure: if no-close flag is set caps will be applied
+ * instead of joins
+ * SWF_LINESTYLE_FLAG_NOCLOSE
+ *
+ * End-cap style: default round
+ * SWF_LINESTYLE_FLAG_ENDCAP_ROUND
+ * SWF_LINESTYLE_FLAG_ENDCAP_NONE
+ * SWF_LINESTYLE_FLAG_ENDCAP_SQUARE
+ *
+ * If join style is SWF_LINESTYLE_JOIN_MITER a miter limit factor
+ * must be set. Miter max length is then calculated as:
+ * max miter len = miter limit * width.
+ * If join style is not miter, this value will be ignored.
+ */
+PHP_METHOD(swfshape, setLine2Filled)
+{
+ long width, flags;
+ zval *fill;
+ double limit;
+ SWFFill xfill;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lold", &width, &fill, &flags, &limit) == FAILURE) {
+ return;
+ }
+
+ xfill = getFill(fill TSRMLS_CC);
+ SWFShape_setLine2Filled(getShape(getThis() TSRMLS_CC), width, SWFFill_getFillStyle(xfill), flags, limit);
}
/* }}} */
-static const zend_function_entry swfshape_functions[] = {
+static zend_function_entry swfshape_functions[] = {
PHP_ME(swfshape, __construct, NULL, 0)
PHP_ME(swfshape, setLine, NULL, 0)
PHP_ME(swfshape, addFill, NULL, 0)
PHP_ME(swfshape, drawArc, NULL, 0)
PHP_ME(swfshape, drawCubic, NULL, 0)
PHP_ME(swfshape, drawCubicTo, NULL, 0)
+ PHP_ME(swfshape, end, NULL, 0)
+ PHP_ME(swfshape, useVersion, NULL, 0)
+ PHP_ME(swfshape, setRenderHintingFlags, NULL, 0)
+ PHP_ME(swfshape, getPenX, NULL, 0)
+ PHP_ME(swfshape, getPenY, NULL, 0)
+ PHP_ME(swfshape, hideLine, NULL, 0)
+ PHP_ME(swfshape, drawCharacterBounds, NULL, 0)
+ PHP_ME(swfshape, setLine2, NULL, 0)
+ PHP_ME(swfshape, setLine2Filled, NULL, 0)
{ NULL, NULL, NULL }
};
{
SWFMovieClip sprite = newSWFMovieClip();
int ret = zend_list_insert(sprite, le_swfspritep);
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
object_init_ex(getThis(), sprite_class_entry_ptr);
add_property_resource(getThis(), "sprite", ret);
void *sprite = SWFgetProperty(id, "sprite", 6, le_swfspritep TSRMLS_CC);
if (!sprite) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFSprite");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFSprite");
}
return (SWFMovieClip)sprite;
}
PHP_METHOD(swfsprite, labelFrame)
{
char *label;
- int label_len;
+ long label_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &label, &label_len) == FAILURE) {
return;
long frames;
SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &frames) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &frames) == FAILURE) {
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zsound) == FAILURE) {
return;
}
-
sound = (SWFSound)getSound(zsound TSRMLS_CC);
item = SWFMovieClip_startSound(sprite, sound);
- if (item != NULL) {
+ if(item != NULL) {
/* try and create a displayitem object */
ret = zend_list_insert(item, le_swfsoundinstancep);
object_init_ex(return_value, soundinstance_class_entry_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zsound) == FAILURE) {
return;
}
-
sound = (SWFSound)getSound(zsound TSRMLS_CC);
SWFMovieClip_stopSound(sprite, sound);
}
/* }}} */
+
+/* {{{ proto long swfmovieclip::setSoundStream(mixed file, rate[, skip])
+ Sets sound stream of the SWF movieClip. The parameter can be stream or string. */
+PHP_METHOD(swfsprite, setSoundStream)
+{
+ zval *zfile;
+ double rate, skip = 0;
+ SWFSoundStream sound;
+ SWFInput input = NULL;
+ SWFMovieClip mc = getSprite(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdd", &zfile, &rate, &skip) == FAILURE) {
+ return;
+ }
+
+ switch(Z_TYPE_P(zfile))
+ {
+ case IS_RESOURCE:
+ input = getInput_fromFileResource(zfile TSRMLS_CC);
+ break;
+ case IS_OBJECT:
+ input = getInput(zfile TSRMLS_CC);
+ break;
+ case IS_STRING:
+ input = newSWFInput_filename(Z_STRVAL_P(zfile));
+ if(input == NULL)
+ php_error(E_ERROR, "opening sound file failed");
+ zend_list_addref(zend_list_insert(input, le_swfinputp));
+ break;
+
+ default:
+ php_error(E_ERROR, "swfmovieclip::setSoundStream: need either a filename, "
+ "a file ressource or SWFInput buffer.");
+ }
+ sound = newSWFSoundStream_fromInput(input);
+ SWFMovieClip_setSoundStreamAt(mc, sound, rate, skip);
+ RETURN_LONG(SWFSoundStream_getDuration(sound) / rate);
+}
+/* }}} */
+
+
+/* {{{ proto void swfsprite::setScalingGrid(int x, int y, int w, int h) */
+PHP_METHOD(swfsprite, setScalingGrid)
+{
+ long zx, zy, zw, zh;
+ SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &zx, &zy, &zw, &zh) == FAILURE) {
+ return;
+ }
+
+ SWFMovieClip_setScalingGrid(sprite, zx, zy, zw, zh);
+}
+/* }}} */
+
+/* {{{ proto void swfsprite::removeScalingGrid() */
+PHP_METHOD(swfsprite, removeScalingGrid)
+{
+ SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ SWFMovieClip_removeScalingGrid(sprite);
+}
+/* }}} */
+
+/* {{{ proto void swfsprite::addInitAction(action) */
+PHP_METHOD(swfsprite, addInitAction)
+{
+ zval *zaction;
+
+ SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
+ SWFAction action;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zaction) == FAILURE) {
+ return;
+ }
+
+ action = getAction(zaction TSRMLS_CC);
+ SWFMovieClip_addInitAction(sprite, action);
+}
+/* }}} */
+#endif
+
+// workaround to support SWFSprite and SWFMovieclip objects
+static zend_function_entry swfmovieclip_functions[] = {
+ PHP_ME(swfsprite, __construct, NULL, 0)
+ PHP_ME(swfsprite, add, NULL, 0)
+ PHP_ME(swfsprite, remove, NULL, 0)
+ PHP_ME(swfsprite, nextFrame, NULL, 0)
+ PHP_ME(swfsprite, labelFrame, NULL, 0)
+ PHP_ME(swfsprite, setFrames, NULL, 0)
+#ifdef HAVE_NEW_MING
+ PHP_ME(swfsprite, startSound, NULL, 0)
+ PHP_ME(swfsprite, stopSound, NULL, 0)
+ PHP_ME(swfsprite, setScalingGrid, NULL, 0)
+ PHP_ME(swfsprite, removeScalingGrid, NULL, 0)
+ PHP_ME(swfsprite, setSoundStream, NULL, 0)
+ PHP_ME(swfsprite, addInitAction, NULL, 0)
#endif
+ { NULL, NULL, NULL }
+};
-static const zend_function_entry swfsprite_functions[] = {
+static zend_function_entry swfsprite_functions[] = {
PHP_ME(swfsprite, __construct, NULL, 0)
- PHP_ME(swfsprite, add, NULL, 0)
- PHP_ME(swfsprite, remove, NULL, 0)
+ PHP_ME(swfsprite, add, NULL, 0)
+ PHP_ME(swfsprite, remove, NULL, 0)
PHP_ME(swfsprite, nextFrame, NULL, 0)
PHP_ME(swfsprite, labelFrame, NULL, 0)
PHP_ME(swfsprite, setFrames, NULL, 0)
#ifdef HAVE_NEW_MING
PHP_ME(swfsprite, startSound, NULL, 0)
PHP_ME(swfsprite, stopSound, NULL, 0)
+ PHP_ME(swfsprite, setScalingGrid, NULL, 0)
+ PHP_ME(swfsprite, removeScalingGrid, NULL, 0)
+ PHP_ME(swfsprite, setSoundStream, NULL, 0)
+ PHP_ME(swfsprite, addInitAction, NULL, 0)
#endif
{ NULL, NULL, NULL }
};
/* {{{ SWFText
*/
-/* {{{ proto void swftext::__construct()
+/* {{{ proto void swftext::__construct([version])
Creates new SWFText object */
PHP_METHOD(swftext, __construct)
{
- SWFText text = newSWFText2();
- int ret = zend_list_insert(text, le_swftextp);
+ long version = 0;
+ SWFText text;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &version) == FAILURE) {
+ return;
+ }
+ if (version == 1) {
+ text = newSWFText();
+ }
+ else {
+ text = newSWFText2();
+ }
+ int ret = zend_list_insert(text, le_swftextp);
object_init_ex(getThis(), text_class_entry_ptr);
add_property_resource(getThis(), "text", ret);
zend_list_addref(ret);
void *text = SWFgetProperty(id, "text", 4, le_swftextp TSRMLS_CC);
if (!text) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFText");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFText");
}
return (SWFText)text;
}
/* }}} */
-/* {{{ proto void swftext::setFont(object font)
+/* {{{ proto void swftext::setFont(SWFFont font)
Sets this SWFText object's current font to given font */
PHP_METHOD(swftext, setFont)
{
return;
}
- SWFText_setHeight(text, (float)height);
+ SWFText_setHeight(text, height);
}
/* }}} */
SWFText text = getText(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &spacing) == FAILURE) {
- return;
+ return;
}
- SWFText_setSpacing(text, (float)spacing);
+ SWFText_setSpacing(text, spacing);
}
/* }}} */
return;
}
- SWFText_setXY(text, (float)x, (float)y);
+ SWFText_setXY(text, x, y);
}
/* }}} */
PHP_METHOD(swftext, addString)
{
char *s;
- int s_len;
+ long s_len;
SWFText text = getText(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) == FAILURE) {
PHP_METHOD(swftext, addUTF8String)
{
char *s;
- int s_len;
+ long s_len;
SWFText text = getText(getThis() TSRMLS_CC);
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) == FAILURE) {
return;
}
PHP_METHOD(swftext, addWideString)
{
char *s;
- int s_len;
+ long s_len;
SWFText text = getText(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) == FAILURE) {
Calculates the width of the given string in this text objects current font and size */
PHP_METHOD(swftext, getWidth)
{
- char *zstring;
- int zstring_len;
+ char *string;
+ long string_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
return;
}
- RETURN_DOUBLE(SWFText_getStringWidth(getText(getThis() TSRMLS_CC), zstring));
+ RETURN_DOUBLE(SWFText_getStringWidth(getText(getThis() TSRMLS_CC), string));
}
/* }}} */
PHP_METHOD(swftext, getUTF8Width)
{
- char *zstring;
- int zstring_len, width;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ char *string;
+ long string_len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
return;
}
- width = SWFText_getUTF8StringWidth(getText(getThis() TSRMLS_CC), zstring);
-
- RETURN_DOUBLE(width);
+ RETURN_DOUBLE(SWFText_getUTF8StringWidth(getText(getThis() TSRMLS_CC), string));
}
/* }}} */
/*
PHP_METHOD(swftext, getWideWidth)
{
- char *zstring;
- int zstring_len, width;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ char *string;
+ long string_len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
return;
}
-
- width = SWFText_getWideStringWidth(getText(getThis() TSRMLS_CC), zstring);
-
- RETURN_DOUBLE(width);
+
+ RETURN_DOUBLE(SWFText_getWideStringWidth(getText(getThis() TSRMLS_CC), string));
}
*/
/* }}} */
Returns the ascent of the current font at its current size, or 0 if not available */
PHP_METHOD(swftext, getAscent)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
+ if(ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
}
RETURN_DOUBLE(SWFText_getAscent(getText(getThis() TSRMLS_CC)));
}
Returns the descent of the current font at its current size, or 0 if not available */
PHP_METHOD(swftext, getDescent)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
+ if(ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
}
- RETURN_DOUBLE(SWFText_getDescent(getText(getThis() TSRMLS_CC)));
+ RETURN_DOUBLE(SWFText_getDescent(getText(getThis() TSRMLS_CC)));
}
/* }}} */
Returns the leading of the current font at its current size, or 0 if not available */
PHP_METHOD(swftext, getLeading)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
+ if(ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
}
- RETURN_DOUBLE(SWFText_getLeading(getText(getThis() TSRMLS_CC)));
+ RETURN_DOUBLE(SWFText_getLeading(getText(getThis() TSRMLS_CC)));
}
/* }}} */
-static const zend_function_entry swftext_functions[] = {
+static zend_function_entry swftext_functions[] = {
PHP_ME(swftext, __construct, NULL, 0)
PHP_ME(swftext, setFont, NULL, 0)
PHP_ME(swftext, setHeight, NULL, 0)
SWFTextField field = newSWFTextField();
int ret = zend_list_insert(field, le_swftextfieldp);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
- return;
- }
-
object_init_ex(getThis(), textfield_class_entry_ptr);
add_property_resource(getThis(), "textfield", ret);
zend_list_addref(ret);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
+ return;
+ }
+
SWFTextField_setFlags(field, flags);
}
/* }}} */
void *field = SWFgetProperty(id, "textfield", 9, le_swftextfieldp TSRMLS_CC);
if (!field) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Called object is not an SWFTextField");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFTextField");
}
return (SWFTextField)field;
}
return;
}
- SWFTextField_setFont(field, getFontOrFontChar(font TSRMLS_CC));
+ if(Z_OBJCE_P(font) == font_class_entry_ptr
+ || Z_OBJCE_P(font) == fontchar_class_entry_ptr)
+ {
+ SWFTextField_setFont(field, getFontOrFontChar(font TSRMLS_CC));
+ }
+ else if(Z_OBJCE_P(font) == browserfont_class_entry_ptr)
+ {
+ SWFTextField_setFont(field, (SWFBlock)getBrowserFont(font TSRMLS_CC));
+ }
+ else {
+ php_error(E_ERROR, "not a font object\n");
+ }
}
/* }}} */
PHP_METHOD(swftextfield, setBounds)
{
double width, height;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &width, &height) == FAILURE) {
return;
}
- SWFTextField_setBounds(field, (float)width, (float)height);
+ SWFTextField_setBounds(getTextField(getThis() TSRMLS_CC), width, height);
}
/* }}} */
PHP_METHOD(swftextfield, align)
{
long align;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &align) == FAILURE) {
return;
}
- SWFTextField_setAlignment(field, align);
+ SWFTextField_setAlignment(getTextField(getThis() TSRMLS_CC), align);
}
/* }}} */
PHP_METHOD(swftextfield, setHeight)
{
double height;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &height) == FAILURE) {
return;
}
- SWFTextField_setHeight(field, (float)height);
+ SWFTextField_setHeight(getTextField(getThis() TSRMLS_CC), height);
}
/* }}} */
PHP_METHOD(swftextfield, setLeftMargin)
{
double margin;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &margin) == FAILURE) {
return;
}
- SWFTextField_setLeftMargin(field, (float)margin);
+ SWFTextField_setLeftMargin(getTextField(getThis() TSRMLS_CC), margin);
}
/* }}} */
PHP_METHOD(swftextfield, setRightMargin)
{
double margin;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &margin) == FAILURE) {
return;
}
- SWFTextField_setRightMargin(field, (float)margin);
+ SWFTextField_setRightMargin(getTextField(getThis() TSRMLS_CC), margin);
}
/* }}} */
return;
}
- SWFTextField_setLeftMargin(field, (float)left);
- SWFTextField_setRightMargin(field, (float)right);
+ SWFTextField_setLeftMargin(field, left);
+ SWFTextField_setRightMargin(field, right);
}
/* }}} */
PHP_METHOD(swftextfield, setIndentation)
{
double indent;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &indent) == FAILURE) {
return;
}
- SWFTextField_setIndentation(field, (float)indent);
+ SWFTextField_setIndentation(getTextField(getThis() TSRMLS_CC), indent);
}
/* }}} */
PHP_METHOD(swftextfield, setLineSpacing)
{
double spacing;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &spacing) == FAILURE) {
return;
}
- SWFTextField_setLineSpacing(field, (float)spacing);
+ SWFTextField_setLineSpacing(getTextField(getThis() TSRMLS_CC), spacing);
}
/* }}} */
PHP_METHOD(swftextfield, setColor)
{
long r, g, b, a = 0xff;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &r, &g, &b, &a) == FAILURE) {
return;
}
-
- SWFTextField_setColor(field, (byte)r, (byte)g, (byte)b, (byte)a);
+ SWFTextField_setColor(getTextField(getThis() TSRMLS_CC), (byte)r, (byte)g, (byte)b, (byte)a);
}
/* }}} */
PHP_METHOD(swftextfield, setName)
{
char *name;
- int name_len;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
+ long name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
- SWFTextField_setVariableName(field, name);
+ SWFTextField_setVariableName(getTextField(getThis() TSRMLS_CC), name);
}
/* }}} */
Adds the given string to this textfield */
PHP_METHOD(swftextfield, addString)
{
- char *string;
- int string_len;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
+ char *str;
+ long str_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ return;
+ }
+
+ SWFTextField_addString(getTextField(getThis() TSRMLS_CC), str);
+}
+/* }}} */
+
+/* {{{ proto void swftextfield::addUTF8String(string str)
+ Adds the given UTF8 string to this textfield */
+PHP_METHOD(swftextfield, addUTF8String)
+{
+ char *str;
+ long str_len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return;
}
- SWFTextField_addString(field, string);
+ SWFTextField_addUTF8String(getTextField(getThis() TSRMLS_CC), str);
}
/* }}} */
+
#ifdef HAVE_NEW_MING
/* {{{ proto void swftextfield::setPadding(float padding)
Sets the padding of this textfield */
PHP_METHOD(swftextfield, setPadding)
{
double padding;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &padding) == FAILURE) {
return;
}
- SWFTextField_setPadding(field, padding);
+ SWFTextField_setPadding(getTextField(getThis() TSRMLS_CC), padding);
}
/* }}} */
adds characters to a font that will be available within a textfield */
PHP_METHOD(swftextfield, addChars)
{
- char *zstring;
- int zstring_len;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
+ char *str;
+ long str_len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ return;
+ }
+
+ SWFTextField_addChars(getTextField(getThis() TSRMLS_CC), str);
+
+}
+/* }}} */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+/* {{{ proto void swftextfield::setLength(int len) */
+PHP_METHOD(swftextfield, setLength)
+{
+ long len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &len) == FAILURE) {
+ return;
+ }
+
+ SWFTextField_setLength(getTextField(getThis() TSRMLS_CC), len);
+}
+/* }}} */
+
+/* {{{ proto void swftextfield::setLength(len) */
+PHP_METHOD(swftextfield, setFieldHeight)
+{
+ long h;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &h) == FAILURE) {
return;
}
- SWFTextField_addChars(field, zstring);
+ SWFTextField_setFieldHeight(getTextField(getThis() TSRMLS_CC), h);
}
/* }}} */
+
#endif
-static const zend_function_entry swftextfield_functions[] = {
+static zend_function_entry swftextfield_functions[] = {
PHP_ME(swftextfield, __construct, NULL, 0)
PHP_ME(swftextfield, setFont, NULL, 0)
PHP_ME(swftextfield, setBounds, NULL, 0)
PHP_ME(swftextfield, setColor, NULL, 0)
PHP_ME(swftextfield, setName, NULL, 0)
PHP_ME(swftextfield, addString, NULL, 0)
+ PHP_ME(swftextfield, addUTF8String, NULL, 0)
#ifdef HAVE_NEW_MING
PHP_ME(swftextfield, setPadding, NULL, 0)
PHP_ME(swftextfield, addChars, NULL, 0)
+ PHP_ME(swftextfield, setLength, NULL, 0)
+ PHP_ME(swftextfield, setFieldHeight, NULL, 0)
#endif
{ NULL, NULL, NULL }
};
}
/* }}} */
-/* {{{ todo PHP_MINIT_FUNCTION(ming)
-*/
+#if PHP_API_VERSION == 20020918
+static php4_fix_funcnames(char *class_name, zend_function_entry *funcs)
+{
+ zend_function_entry *pf = funcs;
+ char *pname;
+
+ while(funcs->fname) {
+ if( strcmp(funcs->fname,"__construct") == 0 ) {
+ pname=strdup(class_name);
+ } else {
+ pname=strdup(funcs->fname);
+ }
+ funcs->fname=pname;
+ while(*pname) { *pname=tolower(*pname);pname++;}
+ funcs++;
+ }
+}
+#endif
/* custom error handler propagates ming errors up to php */
static void php_ming_error(const char *msg, ...)
vspprintf(&buffer, 0, msg, args);
va_end(args);
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "%s", buffer);
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "%s", buffer);
efree(buffer);
}
/* XXX - this didn't work so well last I tried.. */
if (Ming_init() != 0) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Error initializing Ming module");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error initializing Ming module");
return FAILURE;
}
return SUCCESS;
}
+/* {{{ todo PHP_MINIT_FUNCTION(ming)
+*/
PHP_MINIT_FUNCTION(ming)
{
zend_class_entry shape_class_entry;
zend_class_entry button_class_entry;
zend_class_entry action_class_entry;
zend_class_entry morph_class_entry;
+ zend_class_entry movieclip_class_entry;
zend_class_entry sprite_class_entry;
zend_class_entry sound_class_entry;
#ifdef HAVE_NEW_MING
zend_class_entry fontchar_class_entry;
zend_class_entry soundinstance_class_entry;
zend_class_entry videostream_class_entry;
-#endif
-#ifdef HAVE_SWFPREBUILTCLIP
+ zend_class_entry buttonrecord_class_entry;
+ zend_class_entry binarydata_class_entry;
+ zend_class_entry initaction_class_entry;
zend_class_entry prebuiltclip_class_entry;
+ zend_class_entry soundstream_class_entry;
+ zend_class_entry filter_class_entry;
+ zend_class_entry filtermatrix_class_entry;
+ zend_class_entry blur_class_entry;
+ zend_class_entry shadow_class_entry;
+ zend_class_entry cxform_class_entry;
+ zend_class_entry matrix_class_entry;
+ zend_class_entry input_class_entry;
+ zend_class_entry browserfont_class_entry;
+ zend_class_entry fontcollection_class_entry;
#endif
-
+ zend_class_entry character_class_entry;
Ming_setErrorFunction((void *) php_ming_error);
#define CONSTANT(s,c) REGISTER_LONG_CONSTANT((s), (c), CONST_CS | CONST_PERSISTENT)
CONSTANT("SWFFILL_CLIPPED_BITMAP", SWFFILL_CLIPPED_BITMAP);
/* flags for SWFTextField_init */
- CONSTANT("SWFTEXTFIELD_HASLENGTH", SWFTEXTFIELD_HASLENGTH);
CONSTANT("SWFTEXTFIELD_NOEDIT", SWFTEXTFIELD_NOEDIT);
CONSTANT("SWFTEXTFIELD_PASSWORD", SWFTEXTFIELD_PASSWORD);
CONSTANT("SWFTEXTFIELD_MULTILINE", SWFTEXTFIELD_MULTILINE);
CONSTANT("SWFTEXTFIELD_DRAWBOX", SWFTEXTFIELD_DRAWBOX);
CONSTANT("SWFTEXTFIELD_NOSELECT", SWFTEXTFIELD_NOSELECT);
CONSTANT("SWFTEXTFIELD_HTML", SWFTEXTFIELD_HTML);
- CONSTANT("SWFTEXTFIELD_USEFONT", SWFTEXTFIELD_USEFONT);
CONSTANT("SWFTEXTFIELD_AUTOSIZE", SWFTEXTFIELD_AUTOSIZE);
/* flags for SWFTextField_align */
CONSTANT("SWFACTION_KEYDOWN", SWFACTION_KEYDOWN);
CONSTANT("SWFACTION_KEYUP", SWFACTION_KEYUP);
CONSTANT("SWFACTION_DATA", SWFACTION_DATA);
+ CONSTANT("SWFACTION_INIT", SWFACTION_INIT);
+ CONSTANT("SWFACTION_PRESS", SWFACTION_PRESS);
+ CONSTANT("SWFACTION_RELEASE", SWFACTION_RELEASE);
+ CONSTANT("SWFACTION_RELEASEOUTSIDE", SWFACTION_RELEASEOUTSIDE);
+ CONSTANT("SWFACTION_ROLLOVER", SWFACTION_ROLLOVER);
+ CONSTANT("SWFACTION_DRAGOVER", SWFACTION_DRAGOVER);
+ CONSTANT("SWFACTION_DRAGOUT", SWFACTION_DRAGOUT);
+ CONSTANT("SWFACTION_KEYPRESS", SWFACTION_KEYPRESS);
+ CONSTANT("SWFACTION_CONSTRUCT", SWFACTION_CONSTRUCT);
/* flags for SWFSound */
CONSTANT("SWF_SOUND_NOT_COMPRESSED", SWF_SOUND_NOT_COMPRESSED);
CONSTANT("SWF_SOUND_MONO", SWF_SOUND_MONO);
CONSTANT("SWF_SOUND_STEREO", SWF_SOUND_STEREO);
+#ifdef HAVE_NEW_MING
+ /* Blend Modes */
+ CONSTANT("SWFBLEND_MODE_NORMAL", SWFBLEND_MODE_NORMAL);
+ CONSTANT("SWFBLEND_MODE_LAYER", SWFBLEND_MODE_LAYER);
+ CONSTANT("SWFBLEND_MODE_MULT", SWFBLEND_MODE_MULT);
+ CONSTANT("SWFBLEND_MODE_SCREEN", SWFBLEND_MODE_SCREEN);
+ CONSTANT("SWFBLEND_MODE_DARKEN", SWFBLEND_MODE_DARKEN);
+ CONSTANT("SWFBLEND_MODE_LIGHTEN", SWFBLEND_MODE_LIGHTEN);
+ CONSTANT("SWFBLEND_MODE_ADD", SWFBLEND_MODE_ADD);
+ CONSTANT("SWFBLEND_MODE_SUB", SWFBLEND_MODE_SUB);
+ CONSTANT("SWFBLEND_MODE_DIFF", SWFBLEND_MODE_DIFF);
+ CONSTANT("SWFBLEND_MODE_INV", SWFBLEND_MODE_INV);
+ CONSTANT("SWFBLEND_MODE_ALPHA", SWFBLEND_MODE_ALPHA);
+ CONSTANT("SWFBLEND_MODE_ERASE", SWFBLEND_MODE_ERASE);
+ CONSTANT("SWFBLEND_MODE_OVERLAY", SWFBLEND_MODE_OVERLAY);
+ CONSTANT("SWFBLEND_MODE_HARDLIGHT", SWFBLEND_MODE_HARDLIGHT);
+
+ /* filter types */
+ CONSTANT("SWFFILTER_TYPE_DROPSHADOW", SWFFILTER_TYPE_DROPSHADOW);
+ CONSTANT("SWFFILTER_TYPE_BLUR", SWFFILTER_TYPE_BLUR);
+ CONSTANT("SWFFILTER_TYPE_GLOW", SWFFILTER_TYPE_GLOW);
+ CONSTANT("SWFFILTER_TYPE_BEVEL", SWFFILTER_TYPE_BEVEL);
+ CONSTANT("SWFFILTER_TYPE_GRADIENTGLOW", SWFFILTER_TYPE_GRADIENTGLOW);
+ CONSTANT("SWFFILTER_TYPE_CONVOLUTION", SWFFILTER_TYPE_CONVOLUTION);
+ CONSTANT("SWFFILTER_TYPE_COLORMATRIX", SWFFILTER_TYPE_COLORMATRIX);
+ CONSTANT("SWFFILTER_TYPE_GRADIENTBEVEL", SWFFILTER_TYPE_GRADIENTBEVEL);
+
+ /* filter flags */
+ CONSTANT("SWFFILTER_FLAG_CLAMP", FILTER_FLAG_CLAMP);
+ CONSTANT("SWFFILTER_FLAG_PRESERVE_ALPHA", FILTER_FLAG_PRESERVE_ALPHA);
+
+ /* filter modes */
+ CONSTANT("SWFFILTER_MODE_INNER", FILTER_MODE_INNER);
+ CONSTANT("SWFFILTER_MODE_KO", FILTER_MODE_KO);
+ CONSTANT("SWFFILTER_MODE_COMPOSITE", FILTER_MODE_COMPOSITE);
+ CONSTANT("SWFFILTER_MODE_ONTOP", FILTER_MODE_ONTOP);
+
+ /* new gradient features */
+ CONSTANT("SWF_GRADIENT_PAD", SWF_GRADIENT_PAD);
+ CONSTANT("SWF_GRADIENT_REFLECT", SWF_GRADIENT_REFLECT);
+ CONSTANT("SWF_GRADIENT_REPEAT", SWF_GRADIENT_REPEAT);
+ CONSTANT("SWF_GRADIENT_NORMAL", SWF_GRADIENT_NORMAL);
+ CONSTANT("SWF_GRADIENT_LINEAR", SWF_GRADIENT_LINEAR);
+
+ /* shape options */
+ CONSTANT("SWF_SHAPE3", SWF_SHAPE3);
+ CONSTANT("SWF_SHAPE4", SWF_SHAPE4);
+ CONSTANT("SWF_SHAPE_USESCALINGSTROKES", SWF_SHAPE_USESCALINGSTROKES);
+ CONSTANT("SWF_SHAPE_USENONSCALINGSTROKES", SWF_SHAPE_USENONSCALINGSTROKES);
+
+ /* linestyle 2 flags */
+ CONSTANT("SWF_LINESTYLE_CAP_ROUND", SWF_LINESTYLE_CAP_ROUND);
+ CONSTANT("SWF_LINESTYLE_CAP_NONE", SWF_LINESTYLE_CAP_NONE);
+ CONSTANT("SWF_LINESTYLE_CAP_SQUARE", SWF_LINESTYLE_CAP_SQUARE);
+ CONSTANT("SWF_LINESTYLE_JOIN_ROUND", SWF_LINESTYLE_JOIN_ROUND);
+ CONSTANT("SWF_LINESTYLE_JOIN_BEVEL", SWF_LINESTYLE_JOIN_BEVEL);
+ CONSTANT("SWF_LINESTYLE_JOIN_MITER", SWF_LINESTYLE_JOIN_MITER);
+ CONSTANT("SWF_LINESTYLE_FLAG_NOHSCALE", SWF_LINESTYLE_FLAG_NOHSCALE);
+ CONSTANT("SWF_LINESTYLE_FLAG_NOVSCALE", SWF_LINESTYLE_FLAG_NOVSCALE);
+ CONSTANT("SWF_LINESTYLE_FLAG_HINTING", SWF_LINESTYLE_FLAG_HINTING);
+ CONSTANT("SWF_LINESTYLE_FLAG_NOCLOSE", SWF_LINESTYLE_FLAG_NOCLOSE);
+ CONSTANT("SWF_LINESTYLE_FLAG_ENDCAP_ROUND", SWF_LINESTYLE_FLAG_ENDCAP_ROUND);
+ CONSTANT("SWF_LINESTYLE_FLAG_ENDCAP_NONE", SWF_LINESTYLE_FLAG_ENDCAP_NONE);
+ CONSTANT("SWF_LINESTYLE_FLAG_ENDCAP_SQUARE", SWF_LINESTYLE_FLAG_ENDCAP_SQUARE);
+#endif
+
le_swfshapep = zend_register_list_destructors_ex(destroy_SWFShape_resource, NULL, "SWFShape", module_number);
le_swffillp = zend_register_list_destructors_ex(destroy_SWFFill_resource, NULL, "SWFFill", module_number);
le_swfgradientp = zend_register_list_destructors_ex(destroy_SWFGradient_resource, NULL, "SWFGradient", module_number);
le_swfbuttonp = zend_register_list_destructors_ex(destroy_SWFButton_resource, NULL, "SWFButton", module_number);
le_swfactionp = zend_register_list_destructors_ex(NULL, NULL, "SWFAction", module_number);
le_swfmorphp = zend_register_list_destructors_ex(destroy_SWFMorph_resource, NULL, "SWFMorph", module_number);
+ le_swfmovieclipp = zend_register_list_destructors_ex(destroy_SWFSprite_resource, NULL, "SWFMovieClip", module_number);
le_swfspritep = zend_register_list_destructors_ex(destroy_SWFSprite_resource, NULL, "SWFSprite", module_number);
le_swfinputp = zend_register_list_destructors_ex(destroy_SWFInput_resource, NULL, "SWFInput", module_number);
le_swfsoundp = zend_register_list_destructors_ex(destroy_SWFSound_resource, NULL, "SWFSound", module_number);
#ifdef HAVE_NEW_MING
- le_swffontcharp = zend_register_list_destructors_ex(destroy_SWFFontCharacter_resource, NULL, "SWFFontCharacter", module_number);
+ le_swffontcharp = zend_register_list_destructors_ex(NULL, NULL, "SWFFontCharacter", module_number);
+ le_swfbuttonrecordp = zend_register_list_destructors_ex(NULL, NULL, "SWFButtonRecord", module_number);
le_swfsoundinstancep = zend_register_list_destructors_ex(NULL, NULL, "SWFSoundInstance", module_number);
le_swfvideostreamp = zend_register_list_destructors_ex(destroy_SWFVideoStream_resource, NULL, "SWFVideoStream", module_number);
-#endif
-#ifdef HAVE_SWFPREBUILTCLIP
+ le_swfbinarydatap = zend_register_list_destructors_ex(destroy_SWFBinaryData_resource, NULL, "SWFBinaryData", module_number);
+ le_swfinitactionp = zend_register_list_destructors_ex(NULL, NULL, "SWFInitAction", module_number);
le_swfprebuiltclipp = zend_register_list_destructors_ex(destroy_SWFPrebuiltClip_resource, NULL, "SWFPrebuiltClip", module_number);
+ le_swfsoundstreamp = zend_register_list_destructors_ex(destroy_SWFSoundStream_resource, NULL, "SWFSoundStream", module_number);
+ le_swffilterp = zend_register_list_destructors_ex(destroy_SWFFilter_resource, NULL, "SWFFilter", module_number);
+ le_swfblurp = zend_register_list_destructors_ex(destroy_SWFBlur_resource, NULL, "SWFBlur", module_number);
+ le_swfshadowp = zend_register_list_destructors_ex(destroy_SWFShadow_resource, NULL, "SWFShadow", module_number);
+ le_swffiltermatrixp = zend_register_list_destructors_ex(destroy_SWFFilterMatrix_resource, NULL, "SWFFilterMatrix", module_number);
+ le_swfcharacterp = zend_register_list_destructors_ex(NULL, NULL, "SWFCharacter", module_number);
+ le_swfcxformp = zend_register_list_destructors_ex(destroy_SWFCXform_resource, NULL, "SWFCXform", module_number);
+ le_swfmatrixp = zend_register_list_destructors_ex(NULL, NULL, "SWFMatrix", module_number);
+ le_swfbrowserfontp = zend_register_list_destructors_ex(destroy_SWFBrowserFont_resource, NULL, "SWFBrowserFont", module_number);
+ le_swffontcollectionp = zend_register_list_destructors_ex(destroy_SWFFontCollection_resource, NULL, "SWFFontCollection", module_number);
#endif
INIT_CLASS_ENTRY(shape_class_entry, "SWFShape", swfshape_functions);
INIT_CLASS_ENTRY(button_class_entry, "SWFButton", swfbutton_functions);
INIT_CLASS_ENTRY(action_class_entry, "SWFAction", swfaction_functions);
INIT_CLASS_ENTRY(morph_class_entry, "SWFMorph", swfmorph_functions);
+ INIT_CLASS_ENTRY(movieclip_class_entry, "SWFMovieClip", swfmovieclip_functions);
INIT_CLASS_ENTRY(sprite_class_entry, "SWFSprite", swfsprite_functions);
INIT_CLASS_ENTRY(sound_class_entry, "SWFSound", swfsound_functions);
#ifdef HAVE_NEW_MING
INIT_CLASS_ENTRY(fontchar_class_entry, "SWFFontChar", swffontchar_functions);
+ INIT_CLASS_ENTRY(buttonrecord_class_entry, "SWFButtonRecord", swfbuttonrecord_functions);
INIT_CLASS_ENTRY(soundinstance_class_entry, "SWFSoundInstance", swfsoundinstance_functions);
INIT_CLASS_ENTRY(videostream_class_entry, "SWFVideoStream", swfvideostream_functions);
-#endif
-#ifdef HAVE_SWFPREBUILTCLIP
+ INIT_CLASS_ENTRY(binarydata_class_entry, "SWFBinaryData", swfbinarydata_functions);
+ INIT_CLASS_ENTRY(initaction_class_entry, "SWFInitAction", swfinitaction_functions);
INIT_CLASS_ENTRY(prebuiltclip_class_entry, "SWFPrebuiltClip", swfprebuiltclip_functions);
+ INIT_CLASS_ENTRY(soundstream_class_entry, "SWFSoundStream", swfsoundstream_functions);
+ INIT_CLASS_ENTRY(filter_class_entry, "SWFFilter", swffilter_functions);
+ INIT_CLASS_ENTRY(filtermatrix_class_entry, "SWFFilterMatrix", swffiltermatrix_functions);
+ INIT_CLASS_ENTRY(shadow_class_entry, "SWFShadow", swfshadow_functions);
+ INIT_CLASS_ENTRY(blur_class_entry, "SWFBlur", swfblur_functions);
+ INIT_CLASS_ENTRY(cxform_class_entry, "SWFCXform", swfcxform_functions);
+ INIT_CLASS_ENTRY(matrix_class_entry, "SWFMatrix", swfmatrix_functions);
+ INIT_CLASS_ENTRY(input_class_entry, "SWFInput", swfinput_functions);
+ INIT_CLASS_ENTRY(browserfont_class_entry, "SWFBrowserFont", swfbrowserfont_functions);
+ INIT_CLASS_ENTRY(fontcollection_class_entry, "SWFFontCollection", swffontcollection_functions);
#endif
+ INIT_CLASS_ENTRY(character_class_entry, "SWFCharacter", swfcharacter_functions);
+
shape_class_entry_ptr = zend_register_internal_class(&shape_class_entry TSRMLS_CC);
fill_class_entry_ptr = zend_register_internal_class(&fill_class_entry TSRMLS_CC);
button_class_entry_ptr = zend_register_internal_class(&button_class_entry TSRMLS_CC);
action_class_entry_ptr = zend_register_internal_class(&action_class_entry TSRMLS_CC);
morph_class_entry_ptr = zend_register_internal_class(&morph_class_entry TSRMLS_CC);
+ movieclip_class_entry_ptr = zend_register_internal_class(&movieclip_class_entry TSRMLS_CC);
sprite_class_entry_ptr = zend_register_internal_class(&sprite_class_entry TSRMLS_CC);
sound_class_entry_ptr = zend_register_internal_class(&sound_class_entry TSRMLS_CC);
#ifdef HAVE_NEW_MING
fontchar_class_entry_ptr = zend_register_internal_class(&fontchar_class_entry TSRMLS_CC);
+ buttonrecord_class_entry_ptr = zend_register_internal_class(&buttonrecord_class_entry TSRMLS_CC);
soundinstance_class_entry_ptr = zend_register_internal_class(&soundinstance_class_entry TSRMLS_CC);
videostream_class_entry_ptr = zend_register_internal_class(&videostream_class_entry TSRMLS_CC);
-#endif
-#ifdef HAVE_SWFPREBUILTCLIP
+ binarydata_class_entry_ptr = zend_register_internal_class(&binarydata_class_entry TSRMLS_CC);
+ initaction_class_entry_ptr = zend_register_internal_class(&initaction_class_entry TSRMLS_CC);
prebuiltclip_class_entry_ptr = zend_register_internal_class(&prebuiltclip_class_entry TSRMLS_CC);
+ soundstream_class_entry_ptr = zend_register_internal_class(&soundstream_class_entry TSRMLS_CC);
+ filter_class_entry_ptr = zend_register_internal_class(&filter_class_entry TSRMLS_CC);
+ filtermatrix_class_entry_ptr = zend_register_internal_class(&filtermatrix_class_entry TSRMLS_CC);
+ shadow_class_entry_ptr = zend_register_internal_class(&shadow_class_entry TSRMLS_CC);
+ blur_class_entry_ptr = zend_register_internal_class(&blur_class_entry TSRMLS_CC);
+ cxform_class_entry_ptr = zend_register_internal_class(&cxform_class_entry TSRMLS_CC);
+ matrix_class_entry_ptr = zend_register_internal_class(&matrix_class_entry TSRMLS_CC);
+ input_class_entry_ptr = zend_register_internal_class(&input_class_entry TSRMLS_CC);
+ browserfont_class_entry_ptr = zend_register_internal_class(&browserfont_class_entry TSRMLS_CC);
+ fontcollection_class_entry_ptr = zend_register_internal_class(&fontcollection_class_entry TSRMLS_CC);
#endif
-
+ character_class_entry_ptr = zend_register_internal_class(&character_class_entry TSRMLS_CC);
return SUCCESS;
}
/* }}} */