add blend mode tests
[swfdec.git] / test / image / mask-terminates-clip.c
blobc9bf074bf014ebc020855cf9b7f49a2e9dcea4d6
1 /* gcc `pkg-config --libs --cflags libming` mask-terminates-clip.c -o mask-terminates-clip && ./mask-terminates-clip
2 */
4 #include <ming.h>
6 static SWFBlock
7 get_rectangle (int r, int g, int b)
9 SWFMovieClip clip;
10 SWFShape shape;
11 SWFFillStyle fill;
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;
27 static void
28 do_movie (int version, int reverse)
30 char name[100];
31 SWFMovie movie;
32 SWFDisplayItem item;
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);"
55 ));
56 SWFMovie_nextFrame (movie);
58 sprintf (name, "mask-terminates-clip-%s-%d.swf", reverse ? "mask" : "maskee", version);
59 SWFMovie_save (movie, name);
62 int
63 main (int argc, char **argv)
65 int i;
67 if (Ming_init ())
68 return 1;
70 for (i = 8; i >= 5; i--) {
71 do_movie (i, 0);
72 do_movie (i, 1);
75 return 0;