This project is read-only.

Shape with lines and Bezier

Mar 11, 2010 at 10:47 PM


I have created a shape with line point and bezier points, I was wondering if there´s a way to fill that shape, the same way you can fill a polygon.

Congratulation on the project, its a great tool.

Mar 12, 2010 at 7:40 PM

I agree that filling in a bezier would be useful.  However I'm not yet sure how to best add this option.  I just joined the project.  This is probably one for Kirill.  I'll create a "Work Item" for your request though and let you know if I or someone else gets it done.

Mar 12, 2010 at 8:07 PM

Thanks David,

I try to do it myself, I create a PolyBezierBase that inherits from ShapeBase<System.Windows.Shapes.Path>, and a Polybeziere with this UpdateVisual override

override void UpdateVisual() { var geometry = new PathGeometry(); foreach (Bezier dependency in Dependencies) { var Figure = new PathFigure(); var BezierShape = new BezierSegment(); var p0 = dependency.Point(0); var p1 = dependency.Point(1); var p2 = dependency.Point(2); var p3 = dependency.Point(3); Figure.StartPoint = Drawing.CoordinateSystem.ToPhysical(p0); BezierShape.Point1 = Drawing.CoordinateSystem.ToPhysical(p1); BezierShape.Point2 = Drawing.CoordinateSystem.ToPhysical(p2); BezierShape.Point3 = Drawing.CoordinateSystem.ToPhysical(p3); Figure.IsClosed = true; Figure.IsFilled = true; Figure.Segments = new PathSegmentCollection(){BezierShape}; geometry.Figures.Add(Figure); } geometry.FillRule = FillRule.Nonzero; Shape.Data = geometry; }


But its not draggable and the FillRule don't seem to be applying. Anyway thanks, I will be checking for updates.



Mar 15, 2010 at 12:41 AM

Hi, you might want to check out the implementation of Bezier or Circle or Ellipse.

IsClosed and IsFilled is the right way to go.

I think we should generalize the Bezier example (the simple bezier curve) and change it to Path. One could keep adding segments, bezier curves and arcs to the Path. However this is something for a future version.