📄 ming.c
字号:
static zend_function_entry swffill_functions[] = { PHP_FALIAS(swffill, swffill_init, NULL) PHP_FALIAS(moveto, swffill_moveTo, NULL) PHP_FALIAS(scaleto, swffill_scaleTo, NULL) PHP_FALIAS(rotateto, swffill_rotateTo, NULL) PHP_FALIAS(skewxto, swffill_skewXTo, NULL) PHP_FALIAS(skewyto, swffill_skewYTo, NULL) { NULL, NULL, NULL }};/* {{{ proto class swffill_init(void) Returns a new SWFFill object */PHP_FUNCTION(swffill_init){ 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_FUNCTION(swffill_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); SWFFill_moveTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));}/* }}} *//* {{{ 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_FUNCTION(swffill_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); SWFFill_scaleXYTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_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); SWFFill_scaleXYTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y)); } else { WRONG_PARAM_COUNT; }}/* }}} *//* {{{ proto void swffill_rotateTo(float degrees) Rotates this SWFFill the given (clockwise) degrees from its original orientation */PHP_FUNCTION(swffill_rotateTo){ zval **degrees; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, °rees) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(degrees); SWFFill_rotateTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(degrees));}/* }}} *//* {{{ proto void swffill_skewXTo(float xSkew) Sets this SWFFill's x skew value to xSkew */PHP_FUNCTION(swffill_skewXTo){ zval **x; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(x); SWFFill_skewXTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x));}/* }}} *//* {{{ proto void swffill_skewYTo(float ySkew) Sets this SWFFill's y skew value to ySkew */PHP_FUNCTION(swffill_skewYTo){ zval **y; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(y); SWFFill_skewYTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(y));}/* }}} *//* }}} *//* {{{ SWFFont*/static zend_function_entry swffont_functions[] = { PHP_FALIAS(swffont, swffont_init, NULL) PHP_FALIAS(getwidth, swffont_getWidth, NULL) PHP_FALIAS(getascent, swffont_getAscent, NULL) PHP_FALIAS(getdescent, swffont_getDescent, NULL) PHP_FALIAS(getleading, swffont_getLeading, NULL) { NULL, NULL, NULL }};/* {{{ internal function SWFText getFont(zval *id) Returns the Font object in zval *id */static SWFFont getFont(zval *id TSRMLS_DC){ void *font = SWFgetProperty(id, "font", 4, le_swffontp TSRMLS_CC); if (!font) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFFont"); } return (SWFFont)font;}/* }}} *//* {{{ proto object swffont_init(string filename) Returns a new SWFFont object from given file */PHP_FUNCTION(swffont_init){ zval **zfile; SWFFont font; int ret; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfile) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(zfile); if (strcmp(Z_STRVAL_PP(zfile)+Z_STRLEN_PP(zfile)-4, ".fdb") == 0) { php_stream * stream; FILE * file; stream = php_stream_open_wrapper(Z_STRVAL_PP(zfile), "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); if (stream == NULL) { RETURN_FALSE; } if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&file, REPORT_ERRORS)) { php_stream_close(stream); RETURN_FALSE; } font = loadSWFFontFromFile(file); php_stream_close(stream); } else { font = (SWFFont)newSWFBrowserFont(Z_STRVAL_PP(zfile)); } ret = zend_list_insert(font, le_swffontp); object_init_ex(getThis(), &font_class_entry); add_property_resource(getThis(), "font", ret); zend_list_addref(ret);}static void destroy_SWFFont_resource(zend_rsrc_list_entry *resource TSRMLS_DC){ destroySWFBlock((SWFBlock)resource->ptr);}/* }}} *//* {{{ proto float swffont_getWidth(string str) Calculates the width of the given string in this font at full height */PHP_FUNCTION(swffont_getWidth){ zval **zstring; float width; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(zstring); width = SWFFont_getStringWidth(getFont(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring)); RETURN_DOUBLE(width);}/* }}} *//* {{{ proto float swffont_getAscent(void) Returns the ascent of the font, or 0 if not available */PHP_FUNCTION(swffont_getAscent){ RETURN_DOUBLE(SWFFont_getAscent(getFont(getThis() TSRMLS_CC)));}/* }}} *//* {{{ proto float swffont_getDescent(void) Returns the descent of the font, or 0 if not available */PHP_FUNCTION(swffont_getDescent){ RETURN_DOUBLE(SWFFont_getDescent(getFont(getThis() TSRMLS_CC)));}/* }}} *//* {{{ proto float swffont_getLeading(void) Returns the leading of the font, or 0 if not available */PHP_FUNCTION(swffont_getLeading){ RETURN_DOUBLE(SWFFont_getLeading(getFont(getThis() TSRMLS_CC)));}/* }}} *//* }}} *//* {{{ SWFGradient*/static zend_function_entry swfgradient_functions[] = { PHP_FALIAS(swfgradient, swfgradient_init, NULL) PHP_FALIAS(addentry, swfgradient_addEntry, NULL) { NULL, NULL, NULL }};/* {{{ proto class swfgradient_init(void) Returns a new SWFGradient object */PHP_FUNCTION(swfgradient_init){ SWFGradient gradient = newSWFGradient(); int ret = zend_list_insert(gradient, le_swfgradientp); object_init_ex(getThis(), &gradient_class_entry); add_property_resource(getThis(), "gradient", ret); zend_list_addref(ret);}static void destroy_SWFGradient_resource(zend_rsrc_list_entry *resource TSRMLS_DC){ destroySWFGradient((SWFGradient)resource->ptr);}/* }}} *//* {{{ internal function getGradient Returns the SWFGradient object contained in zval *id */static SWFGradient getGradient(zval *id TSRMLS_DC){ 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 swfgradient_addEntry(float ratio, int r, int g, int b [, int a]) Adds given entry to the gradient */PHP_FUNCTION(swfgradient_addEntry){ zval **ratio, **r, **g, **b; byte a = 0xff; if (ZEND_NUM_ARGS() == 4) { if (zend_get_parameters_ex(4, &ratio, &r, &g, &b) == FAILURE) { WRONG_PARAM_COUNT; } } else if (ZEND_NUM_ARGS() == 5) { zval **za; if (zend_get_parameters_ex(5, &ratio, &r, &g, &b, &za) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(za); a = BYTE_Z_LVAL_PP(za); } else { WRONG_PARAM_COUNT; } convert_to_double_ex(ratio); convert_to_long_ex(r); convert_to_long_ex(g); convert_to_long_ex(b); SWFGradient_addEntry( getGradient(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(ratio), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), a );}/* }}} *//* }}} *//* {{{ SWFMorph */static zend_function_entry swfmorph_functions[] = { PHP_FALIAS(swfmorph, swfmorph_init, NULL) PHP_FALIAS(getshape1, swfmorph_getShape1, NULL) PHP_FALIAS(getshape2, swfmorph_getShape2, NULL) { NULL, NULL, NULL }};/* {{{ proto object swfmorph_init(void) Returns a new SWFMorph object */PHP_FUNCTION(swfmorph_init){ SWFMorph morph = newSWFMorphShape(); int ret = zend_list_insert(morph, le_swfmorphp); object_init_ex(getThis(), &morph_class_entry); add_property_resource(getThis(), "morph", ret); zend_list_addref(ret);}static void destroy_SWFMorph_resource(zend_rsrc_list_entry *resource TSRMLS_DC){ destroySWFMorph((SWFMorph)resource->ptr);}/* }}} *//* {{{ internal function getMorph Returns the SWFMorph object contained in zval *id */static SWFMorph getMorph(zval *id TSRMLS_DC){ void *morph = SWFgetProperty(id, "morph", 5, le_swfmorphp TSRMLS_CC); if (!morph) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFMorph"); } return (SWFMorph)morph;}/* }}} *//* {{{ proto object swfmorph_getShape1(void) Return's this SWFMorph's start shape object */PHP_FUNCTION(swfmorph_getShape1){ SWFMorph morph = getMorph(getThis() TSRMLS_CC); SWFShape shape = SWFMorph_getShape1(morph); int ret = zend_list_insert(shape, le_swfshapep); object_init_ex(return_value, &shape_class_entry); add_property_resource(return_value, "shape", ret); zend_list_addref(ret);}/* }}} *//* {{{ proto object swfmorph_getShape2(void) Return's this SWFMorph's start shape object */PHP_FUNCTION(swfmorph_getShape2){ SWFMorph morph = getMorph(getThis() TSRMLS_CC); SWFShape shape = SWFMorph_getShape2(morph); int ret = zend_list_insert(shape, le_swfshapep); object_init_ex(return_value, &shape_class_entry); add_property_resource(return_value, "shape", ret); zend_list_addref(ret);}/* }}} *//* }}} *//* {{{ SWFMovie*/static zend_function_entry swfmovie_functions[] = { PHP_FALIAS(swfmovie, swfmovie_init, NULL) PHP_FALIAS(nextframe, swfmovie_nextFrame, NULL) PHP_FALIAS(labelframe, swfmovie_labelFrame, NULL) PHP_FALIAS(add, swfmovie_add, NULL) PHP_FALIAS(remove, swfmovie_remove, NULL) PHP_FALIAS(output, swfmovie_output, NULL) PHP_FALIAS(save, swfmovie_save, NULL) PHP_FALIAS(savetofile, swfmovie_saveToFile, NULL) PHP_FALIAS(setbackground, swfmovie_setBackground, NULL) PHP_FALIAS(setrate, swfmovie_setRate, NULL) PHP_FALIAS(setdimension, swfmovie_setDimension, NULL) PHP_FALIAS(setframes, swfmovie_setFrames, NULL)#ifdef HAVE_NEW_MING PHP_FALIAS(streammp3, swfmovie_streamMp3, NULL)#endif { NULL, NULL, NULL }};/* {{{ proto object swfmovie_init(int version) Creates swfmovie object according to the passed version */PHP_FUNCTION(swfmovie_init){ zval **version; SWFMovie movie; int ret; if (ZEND_NUM_ARGS() == 1) { if (zend_get_parameters_ex(1, &version) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(version); movie = newSWFMovie(Z_LVAL_PP(version)); } else { movie = newSWFMovie(4); /* default version 4 */ } ret = zend_list_insert(movie, le_swfmoviep); object_init_ex(getThis(), &movie_class_entry); add_property_resource(getThis(), "movie", ret); zend_list_addref(ret);}static void destroy_SWFMovie_resource(zend_rsrc_list_entry *resource TSRMLS_DC){ destroySWFMovie((SWFMovie)resource->ptr);}/* }}} *//* {{{ getMovie*/static SWFMovie getMovie(zval *id TSRMLS_DC){ void *movie = SWFgetProperty(id, "movie", 5, le_swfmoviep TSRMLS_CC); if (!movie) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFMovie"); } return (SWFMovie)movie;}/* }}} *//* {{{ proto void swfmovie_nextframe(void) */PHP_FUNCTION(swfmovie_nextFrame){ SWFMovie_nextFrame(getMovie(getThis() TSRMLS_CC));}/* }}} *//* {{{ proto void swfmovie_labelframe(string label) Labels frame */PHP_FUNCTION(swfmovie_labelFrame){ zval **label;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -