示例#1
0
 public void DrawBezier(DUIPen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
 {
     pen.RenderTarget = this.target;
     if (pen.IsDefaultStyleProperties)
     {
         using (SharpDX.Direct2D1.PathGeometry pathGeometry = new SharpDX.Direct2D1.PathGeometry(this.target.RenderTarget.Factory))
             using (SharpDX.Direct2D1.GeometrySink geometrySink = pathGeometry.Open())
             {
                 geometrySink.BeginFigure(DxConvert.ToVector2(x1, y1), SharpDX.Direct2D1.FigureBegin.Hollow);
                 geometrySink.AddBezier(new SharpDX.Direct2D1.BezierSegment()
                 {
                     Point1 = DxConvert.ToVector2(x2, y2), Point2 = DxConvert.ToVector2(x3, y3), Point3 = DxConvert.ToVector2(x4, y4)
                 });
                 geometrySink.EndFigure(SharpDX.Direct2D1.FigureEnd.Open);
                 geometrySink.Close();
                 this.target.RenderTarget.DrawGeometry(pathGeometry, pen, pen.Width);
             }
     }
     else
     {
         using (SharpDX.Direct2D1.PathGeometry pathGeometry = new SharpDX.Direct2D1.PathGeometry(this.target.RenderTarget.Factory))
             using (SharpDX.Direct2D1.GeometrySink geometrySink = pathGeometry.Open())
             {
                 geometrySink.BeginFigure(DxConvert.ToVector2(x1, y1), SharpDX.Direct2D1.FigureBegin.Hollow);
                 geometrySink.AddBezier(new SharpDX.Direct2D1.BezierSegment()
                 {
                     Point1 = DxConvert.ToVector2(x2, y2), Point2 = DxConvert.ToVector2(x3, y3), Point3 = DxConvert.ToVector2(x4, y4)
                 });
                 geometrySink.EndFigure(SharpDX.Direct2D1.FigureEnd.Open);
                 geometrySink.Close();
                 this.target.RenderTarget.DrawGeometry(pathGeometry, pen, pen.Width, pen);
             }
     }
 }