Пример #1
0
        public IPathGeometry CreatePathGeometry(ITransform?transformInterface, IEnumerable <IPathFigure> figures, FillRule fillRule)
        {
            var pathGeometry = new PathGeometry()
            {
                FillRule = fillRule
            };

            if (transformInterface != null)
            {
                if (!(transformInterface is Transform transform))
                {
                    throw new InvalidOperationException($"Transforms should all be of type {nameof(Transform)}");
                }

                pathGeometry.Transform = transform;
            }

            XGraphicsCollection <PathFigure> destinationFigures = pathGeometry.Figures;

            foreach (IPathFigure pathFigureInterface in figures)
            {
                if (!(pathFigureInterface is PathFigure pathFigure))
                {
                    throw new InvalidOperationException($"{nameof(CreatePathGeometry)} figures should all be of type {nameof(PathFigure)}");
                }

                destinationFigures.Add(pathFigure);
            }

            return(pathGeometry);
        }
Пример #2
0
        public XCanvas()
        {
            _designMode = DesignerProperties.GetIsInDesignMode(this);
            Children    = new XGraphicsCollection <GraphicsElement>();

            // If anything in the hierarchy changes, invalidate to trigger a redraw
            Changed += Invalidate;
        }
Пример #3
0
        public IPathFigure CreatePathFigure(IEnumerable <IPathSegment> segments, Point startPoint, bool isClosed, bool isFilled)
        {
            var pathFigure = new PathFigure()
            {
                StartPoint = new Wrapper.Point(startPoint),
                IsClosed   = isClosed,
                IsFilled   = isFilled
            };

            XGraphicsCollection <PathSegment> destinationSegments = pathFigure.Segments;

            foreach (IPathSegment pathSegmentInterface in segments)
            {
                if (!(pathSegmentInterface is PathSegment pathSegment))
                {
                    throw new InvalidOperationException($"{nameof(CreatePathFigure)} segments should all be of type {nameof(PathSegment)}");
                }

                destinationSegments.Add(pathSegment);
            }

            return(pathFigure);
        }
Пример #4
0
 public PathFigure()
 {
     Segments = new XGraphicsCollection <PathSegment>();
 }
Пример #5
0
 public Canvas()
 {
     Children = new XGraphicsCollection <GraphicsElement>();
 }
Пример #6
0
 public TransformGroup()
 {
     Children = new XGraphicsCollection <Transform>();
 }
Пример #7
0
 public PathGeometry()
 {
     Figures = new XGraphicsCollection <PathFigure>();
 }
Пример #8
0
 public GradientBrush()
 {
     GradientStops = new XGraphicsCollection <GradientStop>();
 }