📄 ming-streams.c
字号:
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); 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 = newSWFJpegWithAlpha_fromInput(input, maskinput); } else bitmap = newSWFBitmap_fromInput(input); ret = zend_list_insert(bitmap, le_swfbitmapp); object_init_ex(getThis(), &bitmap_class_entry); add_property_resource(getThis(), "bitmap", ret); zend_list_addref(ret);}static void destroy_SWFBitmap_resource(zend_rsrc_list_entry *resource TSRMLS_DC){ destroySWFBitmap((SWFBitmap)resource->ptr);}/* }}} *//* {{{ 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(E_ERROR, "called object is not an SWFBitmap!"); return (SWFBitmap)bitmap;}/* }}} *//* {{{ proto void swfbitmap_getWidth(void) Returns the width of this bitmap */PHP_FUNCTION(swfbitmap_getWidth){ if(ZEND_NUM_ARGS() != 0) WRONG_PARAM_COUNT; RETURN_DOUBLE(SWFBitmap_getWidth(getBitmap(getThis() TSRMLS_CC)));}/* }}} *//* {{{ proto void swfbitmap_getHeight(void) Returns the height of this bitmap */PHP_FUNCTION(swfbitmap_getHeight){ if(ZEND_NUM_ARGS() != 0) WRONG_PARAM_COUNT; RETURN_DOUBLE(SWFBitmap_getHeight(getBitmap(getThis() TSRMLS_CC)));}/* }}} *//* }}} *//* {{{ SWFButton */static zend_function_entry swfbutton_functions[] = { PHP_FALIAS(swfbutton, swfbutton_init, NULL) PHP_FALIAS(sethit, swfbutton_setHit, NULL) PHP_FALIAS(setover, swfbutton_setOver, NULL) PHP_FALIAS(setup, swfbutton_setUp, NULL) PHP_FALIAS(setdown, swfbutton_setDown, NULL) PHP_FALIAS(setaction, swfbutton_setAction, NULL) PHP_FALIAS(addshape, swfbutton_addShape, NULL) PHP_FALIAS(setmenu, swfbutton_setMenu, NULL) PHP_FALIAS(addaction, swfbutton_addAction, NULL) { NULL, NULL, NULL }};/* {{{ proto object swfbutton_init(void) Returns a new SWFButton object */PHP_FUNCTION(swfbutton_init){ SWFButton button = newSWFButton(); int ret = zend_list_insert(button, le_swfbuttonp); object_init_ex(getThis(), &button_class_entry); 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(E_ERROR, "called object is not an SWFButton!"); return (SWFButton)button;}/* }}} *//* {{{ proto void swfbutton_setHit(SWFCharacter) Sets the character for this button's hit test state */PHP_FUNCTION(swfbutton_setHit){ zval **zchar; SWFButton button = getButton(getThis() TSRMLS_CC); SWFCharacter character; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) WRONG_PARAM_COUNT; convert_to_object_ex(zchar); character = getCharacter(*zchar TSRMLS_CC); SWFButton_addShape(button, character, SWFBUTTONRECORD_HITSTATE);}/* }}} *//* {{{ proto void swfbutton_setOver(SWFCharacter) Sets the character for this button's over state */PHP_FUNCTION(swfbutton_setOver){ zval **zchar; SWFButton button = getButton(getThis() TSRMLS_CC); SWFCharacter character; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) WRONG_PARAM_COUNT; convert_to_object_ex(zchar); character = getCharacter(*zchar TSRMLS_CC); SWFButton_addShape(button, character, SWFBUTTONRECORD_OVERSTATE);}/* }}} *//* {{{ proto void swfbutton_setUp(SWFCharacter) Sets the character for this button's up state */PHP_FUNCTION(swfbutton_setUp){ zval **zchar; SWFButton button = getButton(getThis() TSRMLS_CC); SWFCharacter character; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) WRONG_PARAM_COUNT; convert_to_object_ex(zchar); character = getCharacter(*zchar TSRMLS_CC); SWFButton_addShape(button, character, SWFBUTTONRECORD_UPSTATE);}/* }}} *//* {{{ proto void swfbutton_setDown(SWFCharacter) Sets the character for this button's down state */PHP_FUNCTION(swfbutton_setDown){ zval **zchar; SWFButton button = getButton(getThis() TSRMLS_CC); SWFCharacter character; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) WRONG_PARAM_COUNT; convert_to_object_ex(zchar); character = getCharacter(*zchar TSRMLS_CC); SWFButton_addShape(button, character, SWFBUTTONRECORD_DOWNSTATE);}/* }}} *//* {{{ proto void swfbutton_addShape(SWFCharacter character, int flags) Sets the character to display for the condition described in flags */PHP_FUNCTION(swfbutton_addShape){ zval **zchar, **flags; SWFButton button = getButton(getThis() TSRMLS_CC); SWFCharacter character; if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zchar, &flags) == FAILURE) WRONG_PARAM_COUNT; convert_to_object_ex(zchar); character = getCharacter(*zchar TSRMLS_CC); convert_to_long_ex(flags); SWFButton_addShape(button, character, Z_LVAL_PP(flags));}/* }}} *//* {{{ proto void swfbutton_setMenu(int flag) enable track as menu button behaviour */PHP_FUNCTION(swfbutton_setMenu){ zval **zflag; SWFButton button = getButton(getThis() TSRMLS_CC); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zflag) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(zflag); SWFButton_setMenu(button, Z_LVAL_PP(zflag));}/* }}} *//* {{{ proto void swfbutton_setAction(SWFAction) Sets the action to perform when button is pressed */PHP_FUNCTION(swfbutton_setAction){ zval **zaction; SWFButton button = getButton(getThis() TSRMLS_CC); SWFAction action; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zaction) == FAILURE) WRONG_PARAM_COUNT; convert_to_object_ex(zaction); action = getAction(*zaction TSRMLS_CC); SWFButton_addAction(button, action, SWFBUTTON_OVERDOWNTOOVERUP);}/* }}} *//* {{{ proto void swfbutton_addAction(SWFAction action, int flags) Sets the action to perform when conditions described in flags is met */PHP_FUNCTION(swfbutton_addAction){ zval **zaction, **flags; SWFButton button = getButton(getThis() TSRMLS_CC); SWFAction action; if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zaction, &flags) == FAILURE) WRONG_PARAM_COUNT; convert_to_object_ex(zaction); action = getAction(*zaction TSRMLS_CC); convert_to_long_ex(flags); SWFButton_addAction(button, action, Z_LVAL_PP(flags));}/* }}} *//* {{{ proto int swfbutton_keypress(string str) Returns the action flag for keyPress(char) */PHP_FUNCTION(swfbutton_keypress){ zval **key; char c; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &key) == FAILURE) WRONG_PARAM_COUNT; convert_to_string_ex(key); if(Z_STRLEN_PP(key) > 1) php_error(E_ERROR, "SWFBUTTON_KEYPRESS expects only one character!"); c = Z_STRVAL_PP(key)[0]; RETURN_LONG((c&0x7f)<<9);}/* }}} *//* }}} *//* {{{ SWFDisplayitem */static zend_function_entry swfdisplayitem_functions[] = { PHP_FALIAS(moveto, swfdisplayitem_moveTo, NULL) PHP_FALIAS(move, swfdisplayitem_move, NULL) PHP_FALIAS(scaleto, swfdisplayitem_scaleTo, NULL) PHP_FALIAS(scale, swfdisplayitem_scale, NULL) PHP_FALIAS(rotateto, swfdisplayitem_rotateTo, NULL) PHP_FALIAS(rotate, swfdisplayitem_rotate, NULL) PHP_FALIAS(skewxto, swfdisplayitem_skewXTo, NULL) PHP_FALIAS(skewx, swfdisplayitem_skewX, NULL) PHP_FALIAS(skewyto, swfdisplayitem_skewYTo, NULL) PHP_FALIAS(skewy, swfdisplayitem_skewY, NULL) PHP_FALIAS(setmatrix, swfdisplayitem_setMatrix, NULL) PHP_FALIAS(setdepth, swfdisplayitem_setDepth, NULL) PHP_FALIAS(setratio, swfdisplayitem_setRatio, NULL) PHP_FALIAS(addcolor, swfdisplayitem_addColor, NULL) PHP_FALIAS(multcolor, swfdisplayitem_multColor, NULL) PHP_FALIAS(setname, swfdisplayitem_setName, NULL) PHP_FALIAS(addaction, swfdisplayitem_addAction, NULL) PHP_FALIAS(remove, swfdisplayitem_remove, NULL) PHP_FALIAS(setmasklevel, swfdisplayitem_setMaskLevel,NULL) PHP_FALIAS(endmask, swfdisplayitem_endMask, NULL) { NULL, NULL, NULL }};/* {{{ 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(E_ERROR, "called object is not an SWFDisplayItem!"); return (SWFDisplayItem)item;}/* }}} *//* {{{ proto void swfdisplayitem_moveTo(int x, int y) Moves this SWFDisplayItem to movie coordinates (x, y) */PHP_FUNCTION(swfdisplayitem_moveTo){ zval **x, **y; if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(x); convert_to_double_ex(y); SWFDisplayItem_moveTo(getDisplayItem(getThis() TSRMLS_CC), Z_DVAL_PP(x), Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfdisplayitem_move(int dx, int dy) Displaces this SWFDisplayItem by (dx, dy) in movie coordinates */PHP_FUNCTION(swfdisplayitem_move){ zval **x, **y; if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(x); convert_to_double_ex(y); SWFDisplayItem_move(getDisplayItem(getThis() TSRMLS_CC), Z_DVAL_PP(x), Z_DVAL_PP(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_FUNCTION(swfdisplayitem_scaleTo){ zval **x, **y; if(ZEND_NUM_ARGS() == 1) { if(zend_get_parameters_ex(1, &x) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(x); SWFDisplayItem_scaleTo(getDisplayItem(getThis() TSRMLS_CC), Z_DVAL_PP(x), Z_DVAL_PP(x)); } else if(ZEND_NUM_ARGS() == 2) { if(zend_get_parameters_ex(2, &x, &y) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(x); convert_to_double_ex(y); SWFDisplayItem_scaleTo(getDisplayItem(getThis() TSRMLS_CC), Z_DVAL_PP(x), Z_DVAL_PP(y)); } else WRONG_PARAM_COUNT;}/* }}} *//* {{{ proto void swfdisplayitem_scale(float xScale, float yScale) Multiplies this SWFDisplayItem's current x scale by xScale, its y scale by yScale */PHP_FUNCTION(swfdisplayitem_scale){ zval **x, **y; if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(x); convert_to_double_ex(y); SWFDisplayItem_scale(getDisplayItem(getThis() TSRMLS_CC), Z_DVAL_PP(x), Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfdisplayitem_rotateTo(float degrees) Rotates this SWFDisplayItem the given (clockwise) degrees from its original orientation */PHP_FUNCTION(swfdisplayitem_rotateTo){ zval **degrees; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, °rees) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(degrees); SWFDisplayItem_rotateTo(getDisplayItem(getThis() TSRMLS_CC), Z_DVAL_PP(degrees));}/* }}} *//* {{{ proto void swfdisplayitem_rotate(float degrees) Rotates this SWFDisplayItem the given (clockwise) degrees from its current orientation */PHP_FUNCTION(swfdisplayitem_rotate){ zval **degrees; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, °rees) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(degrees); SWFDisplayItem_rotate(getDisplayItem(getThis() TSRMLS_CC), Z_DVAL_PP(degrees));}/* }}} *//* {{{ proto void swfdisplayitem_skewXTo(float xSkew) Sets this SWFDisplayItem's x skew value to xSkew */PHP_FUNCTION(swfdisplayitem_skewXTo){ zval **x; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(x); SWFDisplayItem_skewXTo(getDisplayItem(getThis() TSRMLS_CC), Z_DVAL_PP(x));}/* }}} *//* {{{ proto void swfdisplayitem_skewX(float xSkew) Adds xSkew to this SWFDisplayItem's x skew value */PHP_FUNCTION(swfdisplayitem_skewX){ zval **x; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(x); SWFDisplayItem_skewX(getDisplayItem(getThis() TSRMLS_CC), Z_DVAL_PP(x));}/* }}} *//* {{{ proto void swfdisplayitem_skewYTo(float ySkew) Sets this SWFDisplayItem's y skew value to ySkew */PHP_FUNCTION(swfdisplayitem_skewYTo){ zval **y; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE) WRONG_PARAM_COUNT; convert_to_double_ex(y);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -