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); }
public XCanvas() { _designMode = DesignerProperties.GetIsInDesignMode(this); Children = new XGraphicsCollection <GraphicsElement>(); // If anything in the hierarchy changes, invalidate to trigger a redraw Changed += Invalidate; }
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); }
public PathFigure() { Segments = new XGraphicsCollection <PathSegment>(); }
public Canvas() { Children = new XGraphicsCollection <GraphicsElement>(); }
public TransformGroup() { Children = new XGraphicsCollection <Transform>(); }
public PathGeometry() { Figures = new XGraphicsCollection <PathFigure>(); }
public GradientBrush() { GradientStops = new XGraphicsCollection <GradientStop>(); }