Exemplo n.º 1
0
        internal static bool SyncPolylineFigure(PathFigure figure, IList <Point> points, bool isClosed,
                                                bool isFilled = true)
        {
            if (figure == null)
            {
                throw new ArgumentNullException(nameof(figure));
            }
            var flag = false;

            if (points == null || points.Count == 0)
            {
                flag |= figure.ClearIfSet(PathFigure.StartPointProperty);
                flag |= figure.Segments.EnsureListCount(0);
            }
            else
            {
                flag |= figure.SetIfDifferent(PathFigure.StartPointProperty, points[0]);
                flag |= figure.Segments.EnsureListCount(1, () => new PolyLineSegment());
                flag |= PathSegmentHelper.SyncPolylineSegment(figure.Segments, 0, points, 1,
                                                              points.Count - 1);
            }

            flag |= figure.SetIfDifferent(PathFigure.IsClosedProperty, isClosed);
            return(flag | figure.SetIfDifferent(PathFigure.IsFilledProperty, isFilled));
        }
Exemplo n.º 2
0
            public override PathSegment ApplyTransform(GeneralTransform transform)
            {
                var segment = ArcToBezierSegments(_segment, Start);

                if (segment != null)
                {
                    return(PathSegmentHelper.ApplyTransform(segment, Start, transform));
                }
                _segment.Point = transform.Transform(_segment.Point);
                return(_segment);
            }
Exemplo n.º 3
0
 internal static void ApplyTransform(this PathFigure figure, GeneralTransform transform)
 {
     figure.StartPoint = transform.Transform(figure.StartPoint);
     for (var i = 0; i < figure.Segments.Count; i++)
     {
         var segment =
             PathSegmentHelper.ApplyTransform(figure.Segments[i], figure.StartPoint, transform);
         if (!Equals(figure.Segments[i], segment))
         {
             figure.Segments[i] = segment;
         }
     }
 }