EXPORT BOOL WINAPI s_drawCubicTo(float bx, float by, float cx, float cy) { if (drawCubicTo_flag) { lstrcpy(funcname, "s_drawCubicTo"); SWFShape_drawCubicTo(mhsp_shape, bx, by, cx, cy, ct1, ct2); drawCubicTo_flag = 0; } else { ct1 = bx; ct2 = by; drawCubicTo_flag = 1; } return 0; }
static void out_splines (SWFMovie m, spline_list_array_type shape, int height) { unsigned this_list; color_type last_color = {0,0,0}; for (this_list = 0; this_list < SPLINE_LIST_ARRAY_LENGTH (shape); this_list++) { SWFShape k; unsigned this_spline; spline_list_type list = SPLINE_LIST_ARRAY_ELT (shape, this_list); spline_type first = SPLINE_LIST_ELT (list, 0); if (this_list == 0 || !COLOR_EQUAL(list.color, last_color)) { k = newSWFShape(); SWFShape_setRightFill(k, SWFShape_addSolidFill(k, list.color.r, list.color.g, list.color.b, 0xff)); last_color = list.color; } SWFShape_movePenTo(k, SWFSCALE*START_POINT(first).x, SWFSCALE*height - SWFSCALE*START_POINT(first).y); for (this_spline = 0; this_spline < SPLINE_LIST_LENGTH (list); this_spline++) { spline_type s = SPLINE_LIST_ELT (list, this_spline); if (SPLINE_DEGREE(s) == LINEARTYPE) { SWFShape_drawLineTo(k, SWFSCALE*END_POINT(s).x, SWFSCALE*height - SWFSCALE*END_POINT(s).y); } else { SWFShape_drawCubicTo (k, SWFSCALE*CONTROL1(s).x, SWFSCALE*height - SWFSCALE*CONTROL1(s).y, SWFSCALE*CONTROL2(s).x, SWFSCALE*height - SWFSCALE*CONTROL2(s).y, SWFSCALE*END_POINT(s).x, SWFSCALE*height - SWFSCALE*END_POINT(s).y); } } SWFMovie_add(m,k); } }
static VALUE draw_cubic_to(VALUE self, VALUE bx, VALUE by, VALUE cx, VALUE cy, VALUE dx, VALUE dy ) { SWFShape shape; Data_Get_Struct(self, struct SWFShape_s, shape); return INT2NUM(SWFShape_drawCubicTo(shape, NUM2DBL(bx), NUM2DBL(by), NUM2DBL(cx), NUM2DBL(cy), NUM2DBL(bx), NUM2DBL(by))); }
static void ming_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start, int arrow_at_end, int filled) { SWFMovie movie = (SWFMovie)(job->context); SWFShape shape; obj_state_t *obj = job->obj; gvcolor_t pencolor = obj->pencolor; int i; shape = newSWFShape(); SWFShape_setLine(shape, obj->penwidth, pencolor.u.rgba[0], pencolor.u.rgba[1], pencolor.u.rgba[2], pencolor.u.rgba[3]); SWFShape_movePenTo(shape, A[0].x, A[0].y); for (i = 1; i < n; i+=3) SWFShape_drawCubicTo(shape, A[i].x, A[i].y, A[i+1].x, A[i+1].y, A[i+2].x, A[i+2].y); SWFMovie_add(movie, (SWFBlock)shape); }