1 /* gcc `pkg-config --libs --cflags libming` mask-terminates-clip.c -o mask-terminates-clip && ./mask-terminates-clip
7 get_rectangle (int r
, int g
, int b
)
13 clip
= newSWFMovieClip ();
14 shape
= newSWFShape ();
15 fill
= SWFShape_addSolidFillStyle (shape
, r
, g
, b
, 255);
16 SWFShape_setRightFillStyle (shape
, fill
);
17 SWFShape_drawLineTo (shape
, 100, 0);
18 SWFShape_drawLineTo (shape
, 100, 100);
19 SWFShape_drawLineTo (shape
, 0, 100);
20 SWFShape_drawLineTo (shape
, 0, 0);
22 SWFMovieClip_add (clip
, (SWFBlock
) shape
);
23 SWFMovieClip_nextFrame (clip
);
24 return (SWFBlock
) clip
;
28 do_movie (int version
, int reverse
)
34 movie
= newSWFMovieWithVersion (version
);
35 SWFMovie_setRate (movie
, 1);
36 SWFMovie_setDimension (movie
, 200, 150);
38 item
= SWFMovie_add (movie
, get_rectangle (255, 0, 0));
39 SWFDisplayItem_setDepth (item
, 0);
40 SWFDisplayItem_setName (item
, "a");
41 SWFDisplayItem_setMaskLevel (item
, 2);
43 item
= SWFMovie_add (movie
, get_rectangle (0, 255, 0));
44 SWFDisplayItem_moveTo (item
, 0, 50);
45 SWFDisplayItem_setDepth (item
, 1);
46 SWFDisplayItem_setName (item
, "b");
48 item
= SWFMovie_add (movie
, get_rectangle (0, 0, 255));
49 SWFDisplayItem_moveTo (item
, 50, 0);
50 SWFDisplayItem_setDepth (item
, 3);
51 SWFDisplayItem_setName (item
, "c");
53 SWFMovie_add (movie
, (SWFBlock
) newSWFAction (
54 reverse
? "a.setMask (c); a.setMask (null);" : "c.setMask (a); c.setMask (null);"
56 SWFMovie_nextFrame (movie
);
58 sprintf (name
, "mask-terminates-clip-%s-%d.swf", reverse
? "mask" : "maskee", version
);
59 SWFMovie_save (movie
, name
);
63 main (int argc
, char **argv
)
70 for (i
= 8; i
>= 5; i
--) {