📄 ming.c.orig
字号:
destroySWFBlock((SWFBlock)resource->ptr);}/* {{{ proto void swffontchar_addChars(string) adds characters to a font for exporting font */PHP_FUNCTION(swffontchar_addChars){ zval **zstring; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE) WRONG_PARAM_COUNT; convert_to_string_ex(zstring); SWFFontCharacter_addChars(getFontCharacter(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));}/* }}} *//* {{{ proto void swffontchar_addChars(string) adds characters to a font for exporting font */PHP_FUNCTION(swffontchar_addUTF8Chars){ zval **zstring; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE) WRONG_PARAM_COUNT; convert_to_string_ex(zstring); SWFFontCharacter_addUTF8Chars(getFontCharacter(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));}/* }}} *//* }}} *//* {{{ SWFFont */static zend_function_entry swffont_functions[] = { PHP_FALIAS(swffont, swffont_init, NULL) PHP_FALIAS(getwidth, swffont_getWidth, NULL) PHP_FALIAS(getutf8width, swffont_getUTF8Width, NULL)/* PHP_FALIAS(getwidewidth, swffont_getWideWidth, NULL)*/ PHP_FALIAS(getascent, swffont_getAscent, NULL) PHP_FALIAS(getdescent, swffont_getDescent, NULL) PHP_FALIAS(getleading, swffont_getLeading, NULL)/* PHP_FALIAS(addchars, swffont_addChars, NULL)*/ PHP_FALIAS(getshape, swffont_getShape, NULL) { NULL, NULL, NULL }};/* {{{ internal function SWFText getFont(zval *id) Returns the Font object in zval *id */SWFFont getFont(zval *id TSRMLS_DC){ void *font = SWFgetProperty(id, "font", 4, le_swffontp TSRMLS_CC); if(!font) php_error(E_ERROR, "called object is not an SWFFont!"); return (SWFFont)font;}/* }}} *//* {{{ proto class swffont_init(string filename) Returns a new SWFFont object from given file */PHP_FUNCTION(swffont_init){ FILE *file; 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) { file = VCWD_FOPEN(Z_STRVAL_PP(zfile), "rb"); if(!file) php_error(E_ERROR, "Couldn't find FDB file %s", Z_STRVAL_PP(zfile)); font = loadSWFFontFromFile(file); fclose(file); } 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 int swffont_getWidth(string) 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 int swffont_getUTF8Width(string) Calculates the width of the given string in this font at full height */PHP_FUNCTION(swffont_getUTF8Width){ 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_getUTF8StringWidth(getFont(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring)); RETURN_DOUBLE(width);}/* }}} */// not sure about 0 bytes !!!!!!!!!/* {{{ proto int swffont_getWideWidth(string) Calculates the width of the given string in this font at full height *//*PHP_FUNCTION(swffont_getWideWidth){ 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_getWideStringWidth(getFont(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring)); RETURN_DOUBLE(width);}*//* }}} *//* {{{ proto int swffont_getAscent(void) Returns the ascent of the font, or 0 if not available */PHP_FUNCTION(swffont_getAscent){ if(ZEND_NUM_ARGS() != 0) WRONG_PARAM_COUNT; RETURN_DOUBLE(SWFFont_getAscent(getFont(getThis() TSRMLS_CC)));}/* }}} *//* {{{ proto int swffont_getDescent(void) Returns the descent of the font, or 0 if not available */PHP_FUNCTION(swffont_getDescent){ if(ZEND_NUM_ARGS() != 0) WRONG_PARAM_COUNT; RETURN_DOUBLE(SWFFont_getDescent(getFont(getThis() TSRMLS_CC)));}/* }}} *//* {{{ proto int swffont_getLeading(void) Returns the leading of the font, or 0 if not available */PHP_FUNCTION(swffont_getLeading){ if(ZEND_NUM_ARGS() != 0) WRONG_PARAM_COUNT; RETURN_DOUBLE(SWFFont_getLeading(getFont(getThis() TSRMLS_CC)));}/* }}} *//* {{{ proto void swffont_addChars(string) adds characters to a font required within textfields *//*PHP_FUNCTION(swffont_addChars){ zval **zstring; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE) WRONG_PARAM_COUNT; convert_to_string_ex(zstring); SWFFont_addChars(getFont(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));}*//* }}} *//* {{{ proto char *swffont_getShape(code) Returns the glyph shape of a char as a text string */PHP_FUNCTION(swffont_getShape){ zval **zcode; char *result; if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zcode) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(zcode); result = SWFFont_getShape(getFont(getThis() TSRMLS_CC), Z_LVAL_PP(zcode)); RETVAL_STRING(result, 1); free(result);}/* }}} *//* }}} *//* {{{ 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(E_ERROR, "called object is not an SWFGradient!"); return (SWFGradient)gradient;}/* }}} *//* {{{ proto void swfgradient_addEntry(float ratio, string r, string g, string b [, string 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 = 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), Z_DVAL_PP(ratio), Z_LVAL_PP(r), Z_LVAL_PP(g), 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(E_ERROR, "called object is not an SWFMorph!"); return (SWFMorph)morph;}/* }}} *//* {{{ proto SWFShape swfmorph_getShape1(void) Return's this SWFMorph's start shape */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 SWFShape swfmorph_getShape2(void) Return's this SWFMorph's start shape */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);}/* }}} *//* }}} *//* {{{ SWFSound */static zend_function_entry swfsound_functions[] = { PHP_FALIAS(swfsound, swfsound_init, NULL) { NULL, NULL, NULL }};/* {{{ internal function SWFSound getSound(zval *id) Returns the Sound object in zval *id */SWFSound getSound(zval *id TSRMLS_DC){ void *sound = SWFgetProperty(id, "sound", 5, le_swfsoundp TSRMLS_CC); if(!sound) php_error(E_ERROR, "called object is not an SWFSound!"); return (SWFSound)sound;}/* }}} *//* {{{ proto class swfsound_init(string filename, int flags) Returns a new SWFSound object from given file */PHP_FUNCTION(swfsound_init){ FILE *file; zval **zfile, **zflags; SWFSound sound; SWFInput input; int flags; int ret; if(ZEND_NUM_ARGS() == 1) { if(zend_get_parameters_ex(1, &zfile) == FAILURE) WRONG_PARAM_COUNT; flags = 0; } else if(ZEND_NUM_ARGS() == 2) { if(zend_get_parameters_ex(2, &zfile, &zflags) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(zflags); flags = Z_LVAL_PP(zflags); } else WRONG_PARAM_COUNT; 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); sound = newSWFSound_fromInput(input, flags); ret = zend_list_insert(sound, le_swfsoundp); object_init_ex(getThis(), &sound_class_entry); add_property_resource(getThis(), "sound", ret); zend_list_addref(ret);}static void destroy_SWFSound_resource(zend_rsrc_list_entry *resource TSRMLS_DC){ destroySWFBlock((SWFBlock)resource->ptr);}/* }}} *//* }}} *//* should handle envelope functions *//* {{{ SWFSoundInstance */static zend_function_entry swfsoundinstance_functions[] = { PHP_FALIAS(nomultiple, swfsoundinstance_noMultiple, NULL) PHP_FALIAS(loopinpoint, swfsoundinstance_loopInPoint, NULL) PHP_FALIAS(loopoutpoint, swfsoundinstance_loopOutPoint, NULL) PHP_FALIAS(loopcount, swfsoundinstance_loopCount, NULL) { NULL, NULL, NULL }};/* {{{ internal function SWFSoundInstance getSoundInstance(zval *id) Returns the SoundInstance object in zval *id */SWFSoundInstance getSoundInstance(zval *id TSRMLS_DC){ void *inst = SWFgetProperty(id, "soundinstance", 13, le_swfsoundinstancep TSRMLS_CC); if(!inst) php_error(E_ERROR, "called object is not an SWFSoundInstance!"); return (SWFSoundInstance)inst;}/* }}} *//* {{{ swfsoundinstance_nomultiple */PHP_FUNCTION(swfsoundinstance_noMultiple){ SWFSoundInstance inst = getSoundInstance(getThis() TSRMLS_CC); if(ZEND_NUM_ARGS() != 0) WRONG_PARAM_COUNT; SWFSoundInstance_setNoMultiple(inst);}/* }}} *//* {{{ swfsoundinstance_loopinpoint(point) */PHP_FUNCTION(swfsoundinstance_loopInPoint){ zval **zpoint;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -