⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ming-streams.c

📁 flash swf file player
💻 C
📖 第 1 页 / 共 5 页
字号:
/* }}} *//* {{{ swfmovie_protect*/PHP_FUNCTION(swfmovie_Protect){	SWFMovie movie = getMovie(getThis() TSRMLS_CC);	SWFMovie_Protect(movie);}/* }}} *//* {{{ swfmovie_setrate */PHP_FUNCTION(swfmovie_setRate){  zval **rate;  SWFMovie movie = getMovie(getThis() TSRMLS_CC);  if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &rate) == FAILURE)    WRONG_PARAM_COUNT;  convert_to_double_ex(rate);  SWFMovie_setRate(movie, Z_DVAL_PP(rate));}/* }}} *//* {{{ swfmovie_setDimension */PHP_FUNCTION(swfmovie_setDimension){  zval **x, **y;  SWFMovie movie = getMovie(getThis() TSRMLS_CC);  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);  SWFMovie_setDimension(movie, Z_DVAL_PP(x), Z_DVAL_PP(y));}/* }}} *//* {{{ swfmovie_setframes */PHP_FUNCTION(swfmovie_setFrames){  zval **frames;  SWFMovie movie = getMovie(getThis() TSRMLS_CC);  if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &frames) == FAILURE)    WRONG_PARAM_COUNT;  convert_to_long_ex(frames);  SWFMovie_setNumberOfFrames(movie, Z_LVAL_PP(frames));}/* }}} *//* {{{ swfmovie_streamMp3 */PHP_FUNCTION(swfmovie_streamMp3){  zval **zfile;  SWFSound sound;  SWFInput input;  SWFMovie movie = getMovie(getThis() TSRMLS_CC);  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfile) == FAILURE)    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);  SWFMovie_setSoundStream(movie, sound);}/* }}} *//* {{{ swfmovie_addexport */PHP_FUNCTION(swfmovie_addExport){  zval **zchar, **zname;  int ret;  SWFBlock block;  SWFDisplayItem item;  char *name;  SWFMovie movie = getMovie(getThis() TSRMLS_CC);  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zchar, &zname) == FAILURE)    WRONG_PARAM_COUNT;  convert_to_object_ex(zchar);  convert_to_string_ex(zname);  block = (SWFBlock)getCharacter(*zchar TSRMLS_CC);  SWFMovie_addExport(movie, block,  Z_STRVAL_PP(zname));}/* }}} *//* {{{ swfmovie_writeexports */			PHP_FUNCTION(swfmovie_writeExports){  SWFMovie movie = getMovie(getThis() TSRMLS_CC);  SWFMovie_writeExports(movie);}/* }}} *//* }}} *//* {{{ SWFShape */static zend_function_entry swfshape_functions[] = {  PHP_FALIAS(swfshape,          swfshape_init,               NULL)  PHP_FALIAS(setline,           swfshape_setline,            NULL)  PHP_FALIAS(addfill,           swfshape_addfill,            NULL)  PHP_FALIAS(setleftfill,       swfshape_setleftfill,        NULL)  PHP_FALIAS(setrightfill,      swfshape_setrightfill,       NULL)  PHP_FALIAS(movepento,         swfshape_movepento,          NULL)  PHP_FALIAS(movepen,           swfshape_movepen,            NULL)  PHP_FALIAS(drawlineto,        swfshape_drawlineto,         NULL)  PHP_FALIAS(drawline,          swfshape_drawline,           NULL)  PHP_FALIAS(drawcurveto,       swfshape_drawcurveto,        NULL)  PHP_FALIAS(drawcurve,         swfshape_drawcurve,          NULL)  PHP_FALIAS(drawglyph,         swfshape_drawglyph,          NULL)  PHP_FALIAS(drawcircle,        swfshape_drawcircle,         NULL)  PHP_FALIAS(drawarc,           swfshape_drawarc,            NULL)  PHP_FALIAS(drawcubic,         swfshape_drawcubic,          NULL)  PHP_FALIAS(drawcubicto,       swfshape_drawcubicto,        NULL)  { NULL, NULL, NULL }};/* {{{ proto class swfshape_init(void)   Returns a new SWFShape object */PHP_FUNCTION(swfshape_init){  SWFShape shape = newSWFShape();  int ret = zend_list_insert(shape, le_swfshapep);  object_init_ex(getThis(), &shape_class_entry);  add_property_resource(getThis(), "shape", ret);  zend_list_addref(ret);}static void destroy_SWFShape_resource(zend_rsrc_list_entry *resource TSRMLS_DC){  destroySWFShape((SWFShape)resource->ptr);}/* }}} *//* {{{ internal function getShape   Returns the SWFShape object contained in zval *id */static SWFShape getShape(zval *id TSRMLS_DC){  void *shape = SWFgetProperty(id, "shape", 5, le_swfshapep TSRMLS_CC);  if(!shape)    php_error(E_ERROR, "called object is not an SWFShape!");  return (SWFShape)shape;}/* }}} *//* {{{ proto void swfshape_setline(int width, int r, int g, int b [, int a])   Sets the current line style for this SWFShape */PHP_FUNCTION(swfshape_setline){  zval **w, **r, **g, **b, **a;  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);    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),		     Z_LVAL_PP(w), Z_LVAL_PP(r), Z_LVAL_PP(g),		     Z_LVAL_PP(b), 0xff);  }  else  {    SWFShape_setLine(getShape(getThis() TSRMLS_CC),		     Z_LVAL_PP(w), Z_LVAL_PP(r), Z_LVAL_PP(g),		     Z_LVAL_PP(b), Z_LVAL_PP(a));  }}/* }}} *//* {{{ proto int swfshape_addfill(int fill, int flags)   Returns a fill object, for use with swfshape_setleftfill and swfshape_setrightfill */PHP_FUNCTION(swfshape_addfill){  SWFFill fill;  int ret;  if(ZEND_NUM_ARGS() == 1 || ZEND_NUM_ARGS() == 2)  {    /* it's a gradient or bitmap */    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;    }    convert_to_object_ex(arg1);    if(Z_OBJCE_PP(arg1) == &gradient_class_entry)    {      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)    {      if(flags == 0)	flags = SWFFILL_TILED_BITMAP;      fill = SWFShape_addBitmapFill(getShape(getThis() TSRMLS_CC), getBitmap(*arg1 TSRMLS_CC),				    flags);    }    else      php_error(E_ERROR, "argument to addfill 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;    int 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 = Z_LVAL_PP(za);    }    else      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),				 Z_LVAL_PP(r), Z_LVAL_PP(g),				 Z_LVAL_PP(b), a);  }  else    WRONG_PARAM_COUNT;  if(!fill)    php_error(E_ERROR, "Error adding fill to shape!");  /* return an SWFFill object */  ret = zend_list_insert(fill, le_swffillp);  object_init_ex(return_value, &fill_class_entry);  add_property_resource(return_value, "fill", ret);}/* }}} *//* {{{ proto void swfshape_setleftfill(int fill)   Sets the left side fill style to fill */PHP_FUNCTION(swfshape_setleftfill){  zval **zfill, **r, **g, **b, **a;  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), Z_LVAL_PP(r),				 Z_LVAL_PP(g), 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;    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), Z_LVAL_PP(r),				 Z_LVAL_PP(g), Z_LVAL_PP(b), 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;  }  SWFShape_setLeftFill(getShape(getThis() TSRMLS_CC), fill);}/* }}} *//* {{{ proto void swfshape_setrightfill(int fill)   Sets the right side fill style to fill */PHP_FUNCTION(swfshape_setrightfill){  zval **zfill, **r, **g, **b, **a;  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), Z_LVAL_PP(r),				 Z_LVAL_PP(g), 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;    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), Z_LVAL_PP(r),				 Z_LVAL_PP(g), Z_LVAL_PP(b), 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;  }  SWFShape_setRightFill(getShape(getThis() TSRMLS_CC), fill);}/* }}} *//* {{{ proto void swfshape_movepento(float x, float y)   Moves the pen to shape coordinates (x, y) */PHP_FUNCTION(swfshape_movepento){  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);  SWFShape_movePenTo(getShape(getThis() TSRMLS_CC),		     Z_DVAL_PP(x), Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfshape_movepen(float x, float y)   Moves the pen from its current location by vector (x, y) */PHP_FUNCTION(swfshape_movepen){  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);  SWFShape_movePen(getShape(getThis() TSRMLS_CC),		   Z_DVAL_PP(x), Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfshape_drawlineto(float x, float y)   Draws a line from the current pen position to shape coordinates (x, y) in the current line style */PHP_FUNCTION(swfshape_drawlineto){  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);  SWFShape_drawLineTo(getShape(getThis() TSRMLS_CC), Z_DVAL_PP(x), Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfshape_drawline(float dx, float dy)   Draws a line from the current pen position (x, y) to the point (x+dx, y+dy) in the current line style */PHP_FUNCTION(swfshape_drawline){  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);  SWFShape_drawLine(getShape(getThis() TSRMLS_CC), Z_DVAL_PP(x), Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfshape_drawcurveto(float ax, float ay, float bx, float by [, float dx, float 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, a

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -