static void draw_beziergon (DiaRenderer *self, BezPoint *points, int numpoints, Color *fill, Color *stroke) { DIAG_NOTE(g_message("draw_beziezgon %d points", numpoints)); #if 1 /* Use fallback from base class until another program can * actually correctly show the filled Polycurve created * by Dia (our own import can). */ if (fill) DIA_RENDERER_CLASS(parent_class)->draw_beziergon (self, points, numpoints, fill, NULL); #else if (fill) { WpgRenderer *renderer = WPG_RENDERER (self); WriteFillAttr(renderer, fill, TRUE); draw_bezier (self, points, numpoints, fill); WriteFillAttr(renderer, fill, FALSE); } #endif if (stroke) /* XXX: still not closing the path */ draw_bezier (self, points, numpoints, stroke); }
/* not defined in compatibility layer */ static void fill_bezier(DiaRenderer *self, BezPoint *points, /* Last point must be same as first point */ int numpoints, Color *colour) { WmfRenderer *renderer = WMF_RENDERER (self); W32::HGDIOBJ hBrush, hBrOld; W32::COLORREF rgb = W32COLOR(colour); DIAG_NOTE(renderer, "fill_bezier n:%d %fx%f ...\n", numpoints, points->p1.x, points->p1.y); hBrush = W32::CreateSolidBrush(rgb); hBrOld = W32::SelectObject(renderer->hFileDC, hBrush); W32::BeginPath (renderer->hFileDC); draw_bezier(self, points, numpoints, NULL); W32::EndPath (renderer->hFileDC); W32::FillPath (renderer->hFileDC); W32::SelectObject(renderer->hFileDC, W32::GetStockObject (HOLLOW_BRUSH) ); W32::DeleteObject(hBrush); }
void disp(void) { glClear(GL_COLOR_BUFFER_BIT); draw_points(); if(show_linear) draw_linear(); if(show_catmull_rom) draw_catmull_rom(); if(show_bezier) draw_bezier(); glutSwapBuffers(); }
/*! * \brief Fill and/or stroke a closed path * \memberof _DiaPyRenderer */ static void draw_beziergon (DiaRenderer *renderer, BezPoint *points, int num_points, Color *fill, Color *stroke) { PyObject *func, *res, *arg, *self = PYDIA_RENDERER (renderer); func = PyObject_GetAttrString (self, "draw_beziergon"); if (func && PyCallable_Check(func)) { PyObject *obt = PyDiaBezPointTuple_New (points, num_points); PyObject *fill_po; PyObject *stroke_po; Py_INCREF(self); Py_INCREF(func); /* we have to provide a Python object even if there is no color */ if (fill) fill_po = PyDiaColor_New (fill); else Py_INCREF(Py_None), fill_po = Py_None; if (stroke) stroke_po = PyDiaColor_New (stroke); else Py_INCREF(Py_None), stroke_po = Py_None; arg = Py_BuildValue ("(OOO)", obt, fill_po, stroke_po); if (arg) { res = PyEval_CallObject (func, arg); ON_RES(res, FALSE); } Py_XDECREF (arg); Py_XDECREF (obt); Py_XDECREF (fill_po); Py_XDECREF (stroke_po); Py_DECREF(func); Py_DECREF(self); } else { /* member optional */ PyErr_Clear(); /* PyDia only backward compatibility */ if (fill) fill_bezier (renderer, points, num_points, fill); if (stroke) /* XXX: still not closing */ draw_bezier (renderer, points, num_points, stroke); } }