Ejemplo n.º 1
0
        public void DrawLine(
            IElement element,
            IFrameContext context,
            PxPoint point1,
            PxPoint point2,
            Stroke strokeStyle
            )
        {
            if (strokeStyle.Width <= 0)
            {
                return;
            }
            var strokeBrush = CreateBrush(element, context, strokeStyle.Brush, strokeStyle.Opacity);

            if (strokeBrush == null)
            {
                return;
            }

            var dx = Math.Abs(point1.X - point2.X);
            var dy = Math.Abs(point1.Y - point2.Y);

            if (MathEx.IsZero((float)Math.Sqrt((dx * dx) + (dy * dy))))
            {
                return;
            }

            Target.DrawLine(
                point1.ToDx(),
                point2.ToDx(),
                strokeBrush,
                strokeStyle.Width,
                GetStrokeStyle(strokeStyle)
                );
        }
Ejemplo n.º 2
0
 public void BeginPath(D2D1.GeometrySink state, PxPoint point0, bool bFilled)
 {
     state.BeginFigure(
         point0.ToDx(),
         D2D1.FigureBegin.Filled
         );
 }
Ejemplo n.º 3
0
 public void CreateQuadSegment(D2D1.GeometrySink state, PxPoint point0, PxPoint point1, PxPoint point2)
 {
     state.AddQuadraticBezier(new D2D1.QuadraticBezierSegment()
     {
         Point1 = point1.ToDx(),
         Point2 = point2.ToDx()
     });
 }
Ejemplo n.º 4
0
 public void CreateBezierSegment(D2D1.GeometrySink state, PxPoint point0, PxPoint point1, PxPoint point2, PxPoint point3)
 {
     state.AddBezier(new D2D1.BezierSegment()
     {
         Point1 = point1.ToDx(),
         Point2 = point2.ToDx(),
         Point3 = point3.ToDx()
     });
 }
Ejemplo n.º 5
0
 public void CreateArcSegment(D2D1.GeometrySink state, PxPoint point0, PxPoint point1, bool isLargeArc, float axisRotation, float radiusX, float radiusY, bool sweepClockwise)
 {
     state.AddArc(new D2D1.ArcSegment()
     {
         ArcSize        = isLargeArc ? D2D1.ArcSize.Large : D2D1.ArcSize.Small,
         Point          = point1.ToDx(),
         RotationAngle  = axisRotation,
         Size           = new DX.Size2F(radiusX, radiusY),
         SweepDirection = sweepClockwise
 ? D2D1.SweepDirection.Clockwise
 : D2D1.SweepDirection.CounterClockwise
     });
 }
Ejemplo n.º 6
0
 public void CreateLineSegment(D2D1.GeometrySink state, PxPoint point0, PxPoint point1)
 {
     state.AddLine(point1.ToDx());
 }