int main() { SWFMovie m = newSWFMovieWithVersion(8); FILE *file = fopen(MEDIADIR "/image01.dbl", "rb"); if(file == NULL) { perror(MEDIADIR "/image01.dbl"); exit(EXIT_FAILURE); } SWFDBLBitmap img = newSWFDBLBitmap(file); SWFFillStyle fill = newSWFBitmapFillStyle((SWFCharacter)img, SWFFILL_CLIPPED_BITMAP); SWFShape shape = newSWFShape(); SWFShape_setRightFillStyle(shape, fill); SWFShape_setLine(shape, 1, 0,0,0,255); SWFShape_drawLine(shape, 100, 0); SWFShape_drawLine(shape, 0, 100); SWFShape_drawLine(shape, -100, 0); SWFShape_drawLine(shape, 0, -100); SWFMovie_add(m, (SWFBlock)shape); SWFMovie_save(m, "test04.swf"); return 0; }
void swfClip(double x0, double x1, double y0, double y1, pDevDesc dd) { #ifdef SWF_DEBUG Rprintf("clip called\n"); #endif pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific; SWFShape shape = newSWFShape(); SWFFillStyle fill; /* Set previous clip layer to the appropriate depth */ if(swfInfo->currentClip) { SWFDisplayItem_endMask(swfInfo->currentClip); } /* Create new clip layer */ fill = newSWFSolidFillStyle(0xFF, 0xFF, 0xFF, 0xFF); SWFShape_setRightFillStyle(shape, fill); SWFArray_append(swfInfo->array, (SWFObject) fill); SWFShape_movePenTo(shape, x0, y0); SWFShape_drawLineTo(shape, x1, y0); SWFShape_drawLineTo(shape, x1, y1); SWFShape_drawLineTo(shape, x0, y1); SWFShape_drawLineTo(shape, x0, y0); SWFShape_end(shape); swfInfo->currentClip = SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape); SWFDisplayItem_setMaskLevel(swfInfo->currentClip, 99999); }
/* * Creates a shape filled with bitmap */ SWFShape newSWFShapeFromBitmap(SWFBitmap bitmap, int flag) { SWFShape shape = newSWFShape(); SWFFillStyle fill; int width, height; if ( flag != SWFFILL_TILED_BITMAP && flag != SWFFILL_CLIPPED_BITMAP) { SWF_error("Invalid bitmap fill flag"); } fill = SWFShape_addBitmapFillStyle(shape, bitmap, flag); width = SWFBitmap_getWidth(bitmap); height = SWFBitmap_getHeight(bitmap); SWFShape_setRightFillStyle(shape, fill); // XXX - scale shouldn't be hardcoded! (here, or in newSWFBitmapFillStyle) SWFShape_drawScaledLine(shape, width * 20, 0); SWFShape_drawScaledLine(shape, 0, height * 20); SWFShape_drawScaledLine(shape, -width * 20, 0); SWFShape_drawScaledLine(shape, 0, -height * 20); return shape; }
int main() { SWFMovie m = newSWFMovieWithVersion(8); SWFDBLBitmapData img = newSWFDBLBitmapData_fromPngFile(MEDIADIR "/image01.png"); if ( ! img ) { fprintf(stderr, "Could not create bitmap from png file "MEDIADIR"/image01.png\n"); return EXIT_FAILURE; } SWFFillStyle fill = newSWFBitmapFillStyle((SWFCharacter)img, SWFFILL_CLIPPED_BITMAP); if ( ! fill ) { fprintf(stderr, "Could not create bitmap from file "MEDIADIR"/image01.png\n"); return EXIT_FAILURE; } SWFShape shape = newSWFShape(); SWFShape_setRightFillStyle(shape, fill); SWFShape_setLine(shape, 1, 0,0,0,255); SWFShape_drawLine(shape, 100, 0); SWFShape_drawLine(shape, 0, 100); SWFShape_drawLine(shape, -100, 0); SWFShape_drawLine(shape, 0, -100); SWFMovie_add(m, (SWFBlock)shape); SWFMovie_save(m, "test05.swf"); return 0; }
/* R uses gc->col for text color, but actually we need to "fill" the outlines */ void swfSetTextColor(SWFShape shape, const pGEcontext gc, pswfDesc swfInfo) { SWFFillStyle fill; fill = newSWFSolidFillStyle(R_RED(gc->col), R_GREEN(gc->col), R_BLUE(gc->col), R_ALPHA(gc->col)); SWFShape_setRightFillStyle(shape, fill); SWFArray_append(swfInfo->array, (SWFObject) fill); }
static VALUE right_fill_style(VALUE self, VALUE _fill_style) { SWFShape shape; SWFFillStyle fill_style; Data_Get_Struct(self, struct SWFShape_s, shape); Data_Get_Struct(_fill_style, struct SWFFillStyle_s, fill_style); SWFShape_setRightFillStyle(shape, fill_style); return self; }
static void MingSWFCircle(double x, double y, double r, const pGEcontext gc, pDevDesc RGD) { MingSWFDesc *MGD = (MingSWFDesc *)RGD->deviceSpecific; SWFShape circle = newSWFShape(); SWFMovieClip mcCircle; SWFDisplayItem display_item; char strBuffer[1024]; mcCircle = newSWFMovieClip(); sprintf(strBuffer,"var Label = \"x=<b>%.2f</b>, y=%.2f\\nradius is %.2f\";",x,y,r); SWFMovieClip_add(mcCircle, (SWFBlock) newSWFAction(strBuffer)); if (gc->fill){ SWFShape fcircle; SWFFillStyle fill; fcircle = newSWFShape(); SWFShape_movePenTo(fcircle, x, y); MINGSWF_SET_COLOR(MGD,gc->fill); fill = newSWFSolidFillStyle(MGD->red,MGD->green,MGD->blue,MGD->alpha); SWFShape_setRightFillStyle(fcircle, fill); Fixed_SWFShape_drawCircle(fcircle, r<2.0?2.0:r, 0 , 360); /*SWFMovie_add(MGD->movie, (SWFBlock) fcircle);*/ SWFMovieClip_add(mcCircle, (SWFBlock) fcircle); } SWFShape_movePenTo(circle, x, y); MINGSWF_SET_COLOR(MGD,gc->col); MINGSWF_SET_LINE(MGD,circle,gc); /* curve drawing is flawed with setLine2() for some reason */ /*SWFShape_setLine(circle,gc->lwd,MGD->red,MGD->green,MGD->blue,MGD->alpha);*/ /* SWFShape_drawCircle(circle, (int)(r<2.0?2.0:r)); */ Fixed_SWFShape_drawCircle(circle, r<2.0?2.0:r, 0 , 360); /*SWFDisplayItem_moveTo(SWFMovie_add(MGD->movie, (SWFBlock) circle) , x, y);*/ /* SWFMovie_add(MGD->movie, (SWFBlock) circle);*/ /* destroySWFShape(circle); */ if (gc->fill){ /*destroySWFFillStyle(fill);*/ } SWFMovieClip_add(mcCircle, (SWFBlock) circle); SWFMovieClip_nextFrame(mcCircle); /* Add Label Actions */ MingSWF_SetLabelActions(SWFMovie_add(MGD->movie, (SWFBlock) mcCircle)); #ifdef MINGSWFDEBUG Rprintf("Circle(x=%f,y=%f,r=%f,gc=0x%x,RGD=0x%x)\n",x,y,r,gc,RGD); Rprintf("\tuser coords: x=%f,y=%f\n",fromDeviceX(x,GE_NDC,MGD->RGE),fromDeviceY(y,GE_NDC,MGD->RGE)); #endif }
static void add_rectangle (SWFMovieClip clip, int r, int g, int b) { SWFShape shape; SWFFillStyle fill; shape = newSWFShape (); fill = SWFShape_addSolidFillStyle (shape, r, g, b, 255); SWFShape_setRightFillStyle (shape, fill); SWFShape_drawLineTo (shape, 50, 0); SWFShape_drawLineTo (shape, 50, 50); SWFShape_drawLineTo (shape, 0, 50); SWFShape_drawLineTo (shape, 0, 0); SWFMovieClip_add (clip, (SWFBlock) shape); }
static void MingSWFPolygon(int n, double *x, double *y, const pGEcontext gc, pDevDesc RGD) { int i; MingSWFDesc *MGD = (MingSWFDesc *)RGD->deviceSpecific; SWFShape line = newSWFShape(); if (gc->fill){ SWFShape fline; SWFFillStyle fill; fline = newSWFShape(); MINGSWF_SET_COLOR(MGD,gc->fill); fill = newSWFSolidFillStyle(MGD->red,MGD->green,MGD->blue,MGD->alpha); SWFShape_setRightFillStyle(fline, fill); SWFShape_movePenTo(fline,x[0],y[0]); i = 1; while (i<n) { SWFShape_drawLineTo(fline, x[i], y[i]); i++; } /* For some reason fills bleed. So ensure they don't */ if (((int)x[0] != (int)x[n-1]) || ((int)y[0]!=(int)y[n-1])) SWFShape_drawLineTo(fline, x[0], y[0]); SWFMovie_add(MGD->movie, (SWFBlock) fline); } MINGSWF_SET_COLOR(MGD,gc->col); MINGSWF_SET_LINE(MGD,line,gc); SWFShape_movePenTo(line,x[0],y[0]); i = 1; while (i<n) { SWFShape_drawLineTo(line, x[i], y[i]); i++; } /*SWFDisplayItem_moveTo(SWFMovie_add(MGD->movie, (SWFBlock) line),0,0);*/ SWFMovie_add(MGD->movie, (SWFBlock) line); /*destroySWFShape(line);*/ #ifdef MINGSWFDEBUG { int i=0; Rprintf("Polygon(n=%d,x=0x%x,y=0x%x,gc=0x%x,RGD=0x%x)\n\tpoints: ",n,x,y,gc,RGD); while(i<n){ Rprintf("(%.2f,%.2f) ",x[i],y[i]); i++;} Rprintf("\n"); } #endif }
static void SWF_SetFill(SWFShape shape, const pGEcontext plotParams, swfDevDesc *swfInfo ){ /* * Some Notes on Color * * R uses a 24-bit color model. Colors are specified in 32-bit * integers which are partitioned into 4 bytes as follows. * * <-- most sig least sig --> * +-------------------------------+ * | 0 | blue | green | red | * +-------------------------------+ * * The red, green and blue bytes can be extracted as follows. * * red = ((color ) & 255) * green = ((color >> 8) & 255) * blue = ((color >> 16) & 255) */ byte red = R_RED(plotParams->fill); byte green = R_GREEN(plotParams->fill); byte blue = R_BLUE(plotParams->fill); //Top 8 bits: 255 = opaque, 0 = transparent byte alpha = R_ALPHA(plotParams->fill); if( swfInfo->debug == TRUE ){ fprintf(swfInfo->logFile,"\tFill: Red=%d, ",red); fprintf(swfInfo->logFile,"Green=%d, ",green); fprintf(swfInfo->logFile,"Blue=%d, ",blue); fprintf(swfInfo->logFile,"Alpha=%d\n",alpha); fflush(swfInfo->logFile); } SWFFillStyle fill_style; fill_style = newSWFSolidFillStyle( red, green, blue, alpha ); if(fill_style == NULL) error("Failed to allocate memory for fill object!"); SWFShape_setRightFillStyle(shape, fill_style); }
void add_window(SWFMovie mo, int x, int y) { SWFShape sh_window; SWFFillStyle fstyle; SWFMovieClip mc_window; SWFDisplayItem it; sh_window = newSWFShape(); fstyle = SWFShape_addSolidFillStyle(sh_window, 0,0,0,255); SWFShape_setRightFillStyle(sh_window, fstyle); SWFShape_movePenTo(sh_window, 170, 170); SWFShape_drawLine(sh_window, -170, 0); SWFShape_drawLine(sh_window, 0, -170); SWFShape_drawLine(sh_window, 170, 0); SWFShape_drawLine(sh_window, 0, 170); mc_window = newSWFMovieClip(); SWFMovieClip_add(mc_window, (SWFBlock)sh_window); SWFMovieClip_add(mc_window, (SWFBlock)newSWFAction( "_root.xcheck(getBytesLoaded() < _root.getBytesLoaded());" "_root.xcheck(getBytesTotal() < _root.getBytesTotal());" )); SWFMovieClip_nextFrame(mc_window); /* showFrame */ it = SWFMovie_add(mo, (SWFBlock)mc_window); SWFDisplayItem_setName(it, "window"); SWFDisplayItem_moveTo(it, x, y); SWFDisplayItem_addAction(it, compileSWFActionCode( "_root.note('Click on \"Load PNG\" to load a PNG movie here.');" ), SWFACTION_ROLLOVER); SWFDisplayItem_addAction(it, compileSWFActionCode( "delete _level0.window.onMouseDown;" ), SWFACTION_ROLLOUT); }
void SWFShape_setRightFill(SWFShape shape, SWFFill fill) { SWFShape_setRightFillStyle(shape, fill==NULL ? NULL : SWFFill_getFillStyle(fill)); }
void SWF_addPlayerControls(double *x, double *y){ //Get the device info by pointer since this can be called from R pDevDesc deviceInfo = GEcurrentDevice()->dev; // Shortcut pointers to variables of interest. swfDevDesc *swfInfo = (swfDevDesc *) deviceInfo->deviceSpecific; // General variables SWFDisplayItem playd; SWFDisplayItem stopd; // Fill styles we create SWFFillStyle dark_blue_fill; SWFFillStyle red_fill; SWFFillStyle green_fill; // Variables used for the play button SWFAction play_action; SWFButton play_button; SWFButtonRecord play_record_down; SWFButtonRecord play_record_up; SWFShape play_shape_down; SWFShape play_shape_up; // Variables used for the stop button SWFAction stop_action; SWFButton stop_button; SWFButtonRecord stop_record_down; SWFButtonRecord stop_record_up; SWFShape stop_shape_down; SWFShape stop_shape_up; if(swfInfo->haveControls == FALSE){ swfInfo->haveControls = TRUE; // Ensure the movie starts out in the "stopped" state SWFMovie_add(swfInfo->m, (SWFBlock) newSWFAction("_root.stop();")); } swfInfo->ControlsX = *x; swfInfo->ControlsY = deviceInfo->top - *y; // Create the fill styles we'll be using red_fill = newSWFSolidFillStyle(0xf0, 0x00, 0x00, 0x99); dark_blue_fill = newSWFSolidFillStyle(0x00, 0x00, 0x90, 0x99); green_fill = newSWFSolidFillStyle(0x00, 0xcc, 0x00, 0x99); // *** Create the Play button *** // Create a shape to be used in the play button for its "UP" state play_shape_up = newSWFShape(); // Use the dark blue fill SWFShape_setRightFillStyle(play_shape_up, green_fill); SWFShape_setLine(play_shape_up, 1, 0x00, 0x00, 0x00, 0xff); SWFShape_movePenTo(play_shape_up, swfInfo->ControlsX-25, swfInfo->ControlsY); SWFShape_drawLine(play_shape_up, 20, 15); SWFShape_drawLine(play_shape_up, -20, 15); SWFShape_drawLine(play_shape_up, 0, -30); // Create a shape to be used in the play button for its "DOWN" state play_shape_down = newSWFShape(); // Use the green fill SWFShape_setRightFillStyle(play_shape_down, dark_blue_fill); SWFShape_setLine(play_shape_down, 1, 0x00, 0x00, 0x00, 0xff); SWFShape_movePenTo(play_shape_down, swfInfo->ControlsX-25, swfInfo->ControlsY); SWFShape_drawLine(play_shape_down, 20, 15); SWFShape_drawLine(play_shape_down, -20, 15); SWFShape_drawLine(play_shape_down, 0, -30); // Create an empty button object we can use play_button = newSWFButton(); // Add the shapes to the button for its various states play_record_up = SWFButton_addCharacter(play_button, (SWFCharacter) play_shape_up, SWFBUTTON_UP|SWFBUTTON_HIT|SWFBUTTON_OVER); play_record_down = SWFButton_addCharacter(play_button, (SWFCharacter) play_shape_down, SWFBUTTON_DOWN); // Add the Play action to the play button play_action = newSWFAction("_root.play();"); SWFButton_addAction(play_button, play_action, SWFBUTTON_MOUSEUP); // *** Create the Stop button *** // Create a shape to be used in the stop button for its "UP" state stop_shape_up = newSWFShape(); // Use the green fill SWFShape_setRightFillStyle(stop_shape_up, red_fill); SWFShape_setLine(stop_shape_up, 1, 0x00, 0x00, 0x00, 0xff); SWFShape_movePenTo(stop_shape_up, swfInfo->ControlsX , swfInfo->ControlsY + 2.5); SWFShape_drawLine(stop_shape_up, 25, 0); SWFShape_drawLine(stop_shape_up, 0, 25); SWFShape_drawLine(stop_shape_up, -25, 0); SWFShape_drawLine(stop_shape_up, 0, -25); // Create a shape to be used in the stop button for its "DOWN" state stop_shape_down = newSWFShape(); // Use the dark blue fill SWFShape_setRightFillStyle(stop_shape_down, dark_blue_fill); SWFShape_setLine(stop_shape_down, 1, 0x00, 0x00, 0x00, 0xff); SWFShape_movePenTo(stop_shape_down, swfInfo->ControlsX , swfInfo->ControlsY + 2.5); SWFShape_drawLine(stop_shape_down, 25, 0); SWFShape_drawLine(stop_shape_down, 0, 25); SWFShape_drawLine(stop_shape_down, -25, 0); SWFShape_drawLine(stop_shape_down, 0, -25); // Create an empty button object we can use stop_button = newSWFButton(); // Add the shapes to the button for its various states stop_record_up = SWFButton_addCharacter(stop_button, (SWFCharacter) stop_shape_up, SWFBUTTON_UP | SWFBUTTON_HIT | SWFBUTTON_OVER); stop_record_down = SWFButton_addCharacter(stop_button, (SWFCharacter) stop_shape_down, SWFBUTTON_DOWN); // Add the Stop action to the stop button stop_action = newSWFAction("_root.stop();"); SWFButton_addAction(stop_button, stop_action, SWFBUTTON_MOUSEUP); // *** Create the movie clip container for the buttons *** // Embed the buttons in a movie clip //movie_clip = newSWFMovieClip(); playd = SWFMovie_add(swfInfo->m, (SWFBlock) play_button); stopd = SWFMovie_add(swfInfo->m, (SWFBlock) stop_button); addToDisplayList( playd ); addToDisplayList( stopd ); // Advance the movie clip one frame, else it doesn't get displayed //SWFMovieClip_nextFrame(movie_clip); // Add the movie clip to the main movie //buttons_display_item = SWFMovie_add(swfInfo->m, movie_clip); //addToDisplayList( buttons_display_item ); // Set the movie clip to be shown higher // in the display stack than the main movie //SWFDisplayItem_setDepth(buttons_display_item, 100); }
int main(int argc, char** argv) { SWFMovie mo; SWFMovieClip mc1, mc2, dejagnuclip; SWFDisplayItem it; SWFShape sh1,sh2; SWFAction ac1, ac2; int i; const char *srcdir="."; if ( argc>1 ) srcdir=argv[1]; else { //fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]); //return 1; } Ming_init(); mo = newSWFMovie(); SWFMovie_setDimension(mo, 800, 600); //SWFMovie_setRate (mo, 1.0); dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600); SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFMovie_nextFrame(mo); sh1 = make_fill_square (100, 300, 60, 60, 255, 0, 0, 255, 0, 0); sh2 = make_fill_square (300, 300, 60, 60, 255, 0, 0, 0, 0, 0); it = SWFMovie_add(mo, (SWFBlock)sh1); SWFDisplayItem_setName(it, "sh1"); SWFDisplayItem_setDepth(it, 3); //place the sh1 DisplayObject at depth 3; it = SWFMovie_add(mo, (SWFBlock)sh2); SWFDisplayItem_setName(it, "sh2"); SWFDisplayItem_setDepth(it, 4); //place the sh2 DisplayObject at depth 4; check(mo, "sh1 != undefined"); check(mo, "sh2 != undefined"); // Do these checks mean that shapes are movieclips? // seems not. check_equals(mo, "typeof(sh1)", "'movieclip'"); check_equals(mo, "typeof(sh2)", "'movieclip'"); check_equals(mo, "typeof(_root)", "'movieclip'"); add_actions(mo, "sh1.var1 = 10;" "sh2.var2 = 20;" ); // Do these checks mean that we can add variables to shapes? // seems not, variable are added to the _root, interesting. check_equals(mo, "sh1.var1", "10"); check_equals(mo, "sh2.var2", "20"); check_equals(mo, "_root.var1", "10"); check_equals(mo, "_root.var2", "20"); check_equals(mo, "sh1._x", "0"); check_equals(mo, "sh2._x", "0"); add_actions(mo, "sh1._x = 0;" "sh2._x = 400;" ); check_equals(mo, "sh1._x", "400"); check_equals(mo, "sh2._x", "400"); check_equals(mo, "_root._x", "400"); add_actions(mo, "_root._x = 0;" ); /* cleanup */ // Do these checks mean that shapes are *not* movieclips? check_equals(mo, "typeof(sh1.getDepth())", "'undefined'"); check_equals(mo, "typeof(sh2.getDepth())", "'undefined'"); // Do these checks mean that shapes are *not* movieclips? check_equals(mo, "typeof(getInstanceAtDepth(-16381))", "'undefined'"); check_equals(mo, "typeof(getInstanceAtDepth(-16380))", "'undefined'"); SWFMovie_nextFrame(mo); /* * UdoG's drawing * * See DrawingApiTest.as (inv8) * */ { /* using left fill, non-closed paths */ SWFDisplayItem it1, it2; SWFShape sh = newSWFShape(); SWFMovieClip mc = newSWFMovieClip(); SWFShape_setLineStyle(sh, 1, 0, 0, 0, 255); SWFShape_setLeftFillStyle(sh, SWFShape_addSolidFillStyle(sh, 0, 255, 0, 255)); SWFShape_movePenTo(sh, 20, 10); /* 0 */ SWFShape_drawLineTo(sh, 40, 10); /* 1 */ SWFShape_drawLineTo(sh, 40, 40); /* 2 */ SWFShape_drawLineTo(sh, 20, 40); /* 3 */ SWFShape_drawLineTo(sh, 20, 10); /* 4 */ SWFShape_drawLineTo(sh, 10, 10); /* 5 */ SWFShape_drawLineTo(sh, 10, 20); /* 6 */ SWFShape_drawLineTo(sh, 30, 20); /* 7 */ SWFShape_drawLineTo(sh, 30, 30); /* 8 */ SWFShape_drawLineTo(sh, 20, 30); /* 9 */ it1 = SWFMovieClip_add(mc, (SWFBlock)sh); // Test that clip events are not invoked for shapes #if 0 // current Ming HEAD chokes if we add an onClipConstruct event... SWFDisplayItem_addAction(it1, newSWFAction( "_root.check(false && 'clip event for shape should not be executed');" SWFACTION_CONSTRUCT); #endif SWFDisplayItem_addAction(it1, newSWFAction( "_root.check(false && 'clip event for shape should not be executed');" ), SWFACTION_ENTERFRAME); SWFDisplayItem_addAction(it1, newSWFAction( "_root.check(false && 'clip event for shape should not be executed');" ), SWFACTION_ONLOAD); SWFDisplayItem_addAction(it1, newSWFAction( "_root.check(false && 'clip event for shape should not be executed');" ), SWFACTION_UNLOAD); SWFDisplayItem_addAction(it1, newSWFAction( "_root.check(false && 'clip event for shape should not be executed');" ), SWFACTION_MOUSEMOVE); SWFDisplayItem_addAction(it1, newSWFAction( "_root.check(false && 'clip event for shape should not be executed');" ), SWFACTION_MOUSEDOWN); // None of these should be executed SWFDisplayItem_addAction(it1, newSWFAction( "_root.check(false && 'clip event for shape should not be executed');" ), SWFACTION_ONLOAD); SWFDisplayItem_moveTo(it1, 80, 120); SWFDisplayItem_scale(it1, 2, 2); SWFMovieClip_nextFrame(mc); it2 = SWFMovie_add(mo, (SWFBlock)mc); } { /* using right fill, non-closed paths */ SWFDisplayItem it; SWFShape sh = newSWFShape(); SWFMovieClip mc = newSWFMovieClip(); SWFShape_setLineStyle(sh, 1, 0, 0, 0, 255); SWFShape_setLeftFillStyle(sh, SWFShape_addSolidFillStyle(sh, 0, 255, 0, 255)); SWFShape_movePenTo(sh, 20, 10); /* 0 */ SWFShape_drawLineTo(sh, 40, 10); /* 1 */ SWFShape_drawLineTo(sh, 40, 40); /* 2 */ SWFShape_drawLineTo(sh, 20, 40); /* 3 */ SWFShape_drawLineTo(sh, 20, 10); /* 4 */ SWFShape_drawLineTo(sh, 10, 10); /* 5 */ SWFShape_drawLineTo(sh, 10, 20); /* 6 */ SWFShape_drawLineTo(sh, 30, 20); /* 7 */ SWFShape_drawLineTo(sh, 30, 30); /* 8 */ SWFShape_drawLineTo(sh, 20, 30); /* 9 */ it = SWFMovieClip_add(mc, (SWFBlock)sh); SWFDisplayItem_moveTo(it, 200, 120); SWFDisplayItem_scale(it, 2, 2); SWFMovieClip_nextFrame(mc); it = SWFMovie_add(mo, (SWFBlock)mc); } { /* using left fill, closed paths */ SWFDisplayItem it; SWFShape sh = newSWFShape(); SWFMovieClip mc = newSWFMovieClip(); SWFShape_setLineStyle(sh, 1, 0, 0, 0, 255); SWFShape_setLeftFillStyle(sh, SWFShape_addSolidFillStyle(sh, 255, 0, 0, 255)); SWFShape_movePenTo(sh, 20, 10); /* 0 */ SWFShape_drawLineTo(sh, 40, 10); /* 1 */ SWFShape_drawLineTo(sh, 40, 40); /* 2 */ SWFShape_drawLineTo(sh, 20, 40); /* 3 */ SWFShape_drawLineTo(sh, 20, 10); /* 4 */ SWFShape_drawLineTo(sh, 10, 10); /* 5 */ SWFShape_drawLineTo(sh, 10, 20); /* 6 */ SWFShape_drawLineTo(sh, 30, 20); /* 7 */ SWFShape_drawLineTo(sh, 30, 30); /* 8 */ SWFShape_drawLineTo(sh, 20, 30); /* 9 */ SWFShape_drawLineTo(sh, 20, 10); /* 0 */ it = SWFMovieClip_add(mc, (SWFBlock)sh); SWFDisplayItem_moveTo(it, 80, 200); SWFDisplayItem_scale(it, 2, 2); SWFMovieClip_nextFrame(mc); it = SWFMovie_add(mo, (SWFBlock)mc); } { /* using right fill, closed paths */ SWFDisplayItem it; SWFShape sh = newSWFShape(); SWFMovieClip mc = newSWFMovieClip(); SWFShape_setLineStyle(sh, 1, 0, 0, 0, 255); SWFShape_setRightFillStyle(sh, SWFShape_addSolidFillStyle(sh, 255, 0, 0, 255)); SWFShape_movePenTo(sh, 20, 10); /* 0 */ SWFShape_drawLineTo(sh, 40, 10); /* 1 */ SWFShape_drawLineTo(sh, 40, 40); /* 2 */ SWFShape_drawLineTo(sh, 20, 40); /* 3 */ SWFShape_drawLineTo(sh, 20, 10); /* 4 */ SWFShape_drawLineTo(sh, 10, 10); /* 5 */ SWFShape_drawLineTo(sh, 10, 20); /* 6 */ SWFShape_drawLineTo(sh, 30, 20); /* 7 */ SWFShape_drawLineTo(sh, 30, 30); /* 8 */ SWFShape_drawLineTo(sh, 20, 30); /* 9 */ SWFShape_drawLineTo(sh, 20, 10); /* 0 */ it = SWFMovieClip_add(mc, (SWFBlock)sh); SWFDisplayItem_moveTo(it, 200, 200); SWFDisplayItem_scale(it, 2, 2); SWFMovieClip_nextFrame(mc); it = SWFMovie_add(mo, (SWFBlock)mc); } add_actions(mo, "_root.totals(); stop();"); SWFMovie_nextFrame(mo); //Output movie puts("Saving " OUTPUT_FILENAME ); SWFMovie_save(mo, OUTPUT_FILENAME); return 0; }