1
2 #include <ming.h>
3
main(int argc,char * argv[])4 int main(int argc, char *argv[])
5 {
6 SWFMovie movie;
7 SWFShape shape1;
8 SWFGradient grad_1;
9 SWFFill fill1;
10 SWFDisplayItem timeline;
11 SWFShape shape2;
12 SWFGradient grad_2;
13 SWFFill fill2;
14
15 Ming_init(argc, argv);
16 Ming_useSWFVersion(5);
17 movie= newSWFMovie();
18 SWFMovie_setDimension(movie, 320, 240);
19
20 shape1= newSWFShape();
21
22 /* first gradient- black to white */
23 grad_1= newSWFGradient();
24 SWFGradient_addEntry(grad_1, 0, 0x00, 0x00, 0x00, 0xFF);
25 SWFGradient_addEntry(grad_1, 1, 0xFF, 0xFF, 0xFF, 0xFF);
26
27 fill1= SWFShape_addGradientFill(shape1, grad_1, SWFFILL_LINEAR_GRADIENT);
28 SWFFill_scaleTo(fill1, 0.170, 0.170);
29 SWFFill_moveTo(fill1, 160.00, 120.00);
30 SWFShape_setRightFill(shape1, fill1);
31 SWFShape_drawLineTo(shape1, 320.00, 0.00);
32 SWFShape_drawLineTo(shape1, 320.00, 240.00);
33 SWFShape_drawLineTo(shape1, 0.00, 240.00);
34 SWFShape_drawLineTo(shape1, 0.00, 0.00);
35
36 timeline= SWFMovie_add(movie, (SWFBlock) shape1);
37 /* SWFDisplayItem_moveTo(timeline, 0.00, 0.00);*/
38
39 shape2= newSWFShape();
40
41 /* second gradient- radial gradient from white to red to transparent */
42 grad_2= newSWFGradient();
43 SWFGradient_addEntry(grad_2, 0, 0xFF, 0x00, 0x00, 0xFF);
44 SWFGradient_addEntry(grad_2, 1, 0xFF, 0x00, 0x00, 0x00);
45
46 fill2= SWFShape_addGradientFill(shape2, grad_2, SWFFILL_RADIAL_GRADIENT);
47 SWFFill_scaleTo(fill2, 0.120, 0.120);
48 SWFFill_moveTo(fill2, 160.00, 120.00);
49 SWFShape_setRightFill(shape2, fill2);
50 SWFShape_drawLineTo(shape2, 320.00, 0.00);
51 SWFShape_drawLineTo(shape2, 320.00, 240.00);
52 SWFShape_drawLineTo(shape2, 0.00, 240.00);
53 SWFShape_drawLineTo(shape2, 0.00, 0.00);
54
55 timeline= SWFMovie_add(movie, (SWFBlock) shape2);
56
57 SWFMovie_nextFrame(movie);
58
59 SWFMovie_save(movie, "gradient.swf");
60
61 return 0;
62 }
63
64
65