1 /* gcc `pkg-config --libs --cflags libming` clip-change.c -o clip-change && ./clip-change
7 get_rectangle (int r
, int g
, int b
)
12 shape
= newSWFShape ();
13 fill
= SWFShape_addSolidFillStyle (shape
, r
, g
, b
, 255);
14 SWFShape_setRightFillStyle (shape
, fill
);
15 SWFShape_drawLineTo (shape
, 100, 0);
16 SWFShape_drawLineTo (shape
, 100, 100);
17 SWFShape_drawLineTo (shape
, 0, 100);
18 SWFShape_drawLineTo (shape
, 0, 0);
20 return (SWFBlock
) shape
;
24 do_movie (int version
, int reverse
)
26 const char *suffixes
[4] = { "forward", "backward", "remove", "set" };
29 SWFDisplayItem item
, clip
;
31 movie
= newSWFMovieWithVersion (version
);
32 SWFMovie_setRate (movie
, 1);
33 SWFMovie_setDimension (movie
, 200, 150);
35 clip
= SWFMovie_add (movie
, get_rectangle (255, 0, 0));
36 SWFDisplayItem_setDepth (clip
, 0);
38 SWFDisplayItem_setMaskLevel (clip
, (reverse
& 1) ? 3 : 2);
40 item
= SWFMovie_add (movie
, get_rectangle (0, 255, 0));
41 SWFDisplayItem_moveTo (item
, 0, 50);
42 SWFDisplayItem_setDepth (item
, 2);
44 item
= SWFMovie_add (movie
, get_rectangle (0, 0, 255));
45 SWFDisplayItem_moveTo (item
, 50, 0);
46 SWFDisplayItem_setDepth (item
, 3);
48 SWFMovie_nextFrame (movie
);
50 SWFDisplayItem_setMaskLevel (clip
, (reverse
& 1) ? 2 : 3);
52 SWFDisplayItem_setMaskLevel (clip
, 0);
53 SWFMovie_nextFrame (movie
);
55 sprintf (name
, "clip-change-%s-%d.swf", suffixes
[reverse
], version
);
56 SWFMovie_save (movie
, name
);
60 main (int argc
, char **argv
)
67 for (i
= 8; i
>= 5; i
--) {