5 #include "../gfxtools.h"
9 gfxline_t*mkstar(int x1, int y1, int x2, int y2)
11 gfxline_t*l=0,*line = 0;
13 for(x=x1;x<=x2;x+=50) {
14 l = rfx_calloc(sizeof(gfxline_t));
17 line = gfxline_append(line, l);
19 l = rfx_calloc(sizeof(gfxline_t));
21 l->x = x2-x;l->y = y2;
22 line = gfxline_append(line, l);
29 gfxline_t*box1 = gfxline_makerectangle(50,50,150,150);
30 // put box2 and box3 on top of each other *snicker*
31 gfxline_t*box2 = gfxline_makerectangle(100,100,200,200);
32 gfxline_t*box3 = gfxline_makerectangle(100,100,200,200);
33 gfxline_t*star = mkstar(50,50, 150,150);
35 b = gfxline_append(b, box1);
36 b = gfxline_append(b, box2);
37 b = gfxline_append(b, box3);
38 b = gfxline_append(b, star);
41 memset(&matrix, 0, sizeof(gfxmatrix_t));
43 matrix.m00=cos(ua);matrix.m10=sin(ua);
44 matrix.m01=-sin(ua);matrix.m11=cos(ua);
46 gfxline_transform(b, &matrix);
47 gfxpoly_t*poly = gfxpoly_fillToPoly(b);
54 gfxpoly_process(poly);
62 gfxline_t* line = malloc(sizeof(gfxline_t)*N);
64 line[t].type = t?gfx_lineTo:gfx_moveTo;
65 line[t].x = (lrand48()%RANGE)-RANGE/2;
66 line[t].y = (lrand48()%RANGE)-RANGE/2;
67 line[t].next = &line[t+1];
69 line[N-1].x = line[0].x;
70 line[N-1].y = line[0].y;
73 gfxpoly_t*poly = gfxpoly_fillToPoly(line);
74 gfxpoly_t*poly2 = gfxpoly_process(poly);
76 gfxpoly_destroy(poly);
77 gfxpoly_destroy(poly2);
80 #include "../rfxswf.h"
89 gfxline_t* line = malloc(sizeof(gfxline_t)*N);
91 line[i].type = i?gfx_lineTo:gfx_moveTo;
92 line[i].x = lrand48()%RANGE - RANGE/2;
93 line[i].y = lrand48()%RANGE - RANGE/2;
94 line[i].next = &line[i+1];
96 line[N-1].x = line[0].x;
97 line[N-1].y = line[0].y;
101 memset(&m, 0, sizeof(m));
104 memset(&swf, 0, sizeof(SWF));
105 swf.movieSize.xmax = RANGE*20*1.41;
106 swf.movieSize.ymax = RANGE*20*1.41;
108 swf.frameRate = 25*0x100;
109 TAG * tag = swf.firstTag = swf_InsertTag(0, ST_SETBACKGROUNDCOLOR);
116 m.m00 = cos(t*M_PI/180.0);
117 m.m01 = sin(t*M_PI/180.0);
118 m.m10 = -sin(t*M_PI/180.0);
119 m.m11 = cos(t*M_PI/180.0);
122 gfxline_t*l = gfxline_clone(line);
123 gfxline_transform(l, &m);
125 gfxpoly_t*poly = gfxpoly_fillToPoly(l);
126 gfxpoly_t*poly2 = gfxpoly_process(poly);
128 tag = swf_InsertTag(tag, ST_DEFINESHAPE);
132 rgb.r = rgb.g = 0x00; rgb.b = 0xff;
134 int j = swf_ShapeAddSolidFillStyle(s,&rgb);
136 swf_SetRect(tag,&swf.movieSize);
137 swf_SetShapeHeader(tag,s);
138 swf_ShapeSetAll(tag,s,0,0,0,j,0);
141 swf_ShapeSetMove(tag, s, e->a.x*20, e->a.y*20);
142 swf_ShapeSetLine(tag, s, e->b.x*20 - e->a.x*20, e->b.y*20 - e->a.y*20);
145 swf_ShapeSetEnd(tag);
148 gfxpoly_destroy(poly);
149 gfxpoly_destroy(poly2);
154 tag = swf_InsertTag(tag,ST_REMOVEOBJECT2);
157 tag = swf_InsertTag(tag,ST_PLACEOBJECT2);
158 swf_ObjectPlace(tag,t+1,t+1,NULL,NULL,NULL);
160 tag = swf_InsertTag(tag, ST_SHOWFRAME);
162 tag = swf_InsertTag(tag, ST_END);
164 swf_SaveSWF(&swf, "test.swf");