protected override ShapeRenderData OnCreateRenderData(ShapeRenderParameters renderParams) => this.renderDataCache.GetOrAdd((ShapeDrawType)renderParams.SettingValues[ToolSettings.Null.Shapes.DrawType.Path], delegate(ShapeDrawType drawType) { Geometry geometry = this.source.Geometry; Geometry interiorFillGeometry = ((drawType & ShapeDrawType.Interior) == ShapeDrawType.Interior) ? this.source.Geometry : null; Geometry outlineDrawGeometry = ((drawType & ShapeDrawType.Outline) == ShapeDrawType.Outline) ? this.source.Geometry : null; return(new ShapeRenderData(geometry, interiorFillGeometry, outlineDrawGeometry, null)); });
private Geometry CreateLineCurveGeometry(ShapeRenderParameters renderParams) { Geometry geometry; CurveType type = (CurveType)renderParams.SettingValues[ToolSettings.Null.Shapes.CurveType.Path]; if (renderParams.HasPropertyValues && renderParams.PropertyValues.Any <KeyValuePair <object, object> >()) { RectDouble num = RectDouble.FromCorners(renderParams.StartPoint, renderParams.EndPoint); List <PointDouble> source = new List <PointDouble>(); PointDouble[] numArray = this.GetInitialControlPointValues(renderParams).ToArrayEx <PointDouble>(); bool flag = false; for (int i = 0; i < this.controlPointPropertyNames.Length; i++) { object controlPointPropertyName = this.GetControlPointPropertyName(i); Pair <double, double> pair = (Pair <double, double>)renderParams.PropertyValues[controlPointPropertyName]; if ((pair.First != numArray[i].X) || (pair.Second != numArray[i].Y)) { flag = true; } PointDouble num3 = new PointDouble(pair.First, pair.Second); PointDouble item = new PointDouble(((num3.X - num.X) * renderParams.TransformScale.X) + num.X, ((num3.Y - num.Y) * renderParams.TransformScale.Y) + num.Y); source.Add(item); } if (!flag) { geometry = new LineGeometry(renderParams.StartPoint, renderParams.EndPoint).EnsureFrozen <LineGeometry>(); } else { PathSegment segment; if (type != CurveType.Spline) { if (type != CurveType.Bezier) { throw ExceptionUtil.InvalidEnumArgumentException <CurveType>(type, "curveType"); } } else { PathGeometry geometry1 = new PathGeometry(); PathFigureCollection collection1 = new PathFigureCollection(1); PathFigure figure1 = new PathFigure { StartPoint = source[0], IsClosed = false }; PathSegmentCollection collection2 = new PathSegmentCollection(1); collection2.Add(new PolyCurveSegment(new ListSegment <PointDouble>(source, 1, source.Count - 1))); figure1.Segments = collection2; collection1.Add(figure1); geometry1.Figures = collection1; geometry = geometry1; goto Label_0271; } if (source.Count == 4) { segment = new BezierSegment(source[1], source[2], source[3]); } else { segment = new PolyBezierSegment(new ListSegment <PointDouble>(source, 1, source.Count - 1)); } PathGeometry geometry2 = new PathGeometry(); PathFigureCollection collection3 = new PathFigureCollection(1); PathFigure figure2 = new PathFigure { StartPoint = source[0], IsClosed = false }; PathSegmentCollection collection4 = new PathSegmentCollection(1); collection4.Add(segment); figure2.Segments = collection4; collection3.Add(figure2); geometry2.Figures = collection3; geometry = geometry2; } } else { geometry = new LineGeometry(renderParams.StartPoint, renderParams.EndPoint); } Label_0271: return(geometry.EnsureFrozen <Geometry>()); }
private static LineGeometry CreateGuideGeometry(ShapeRenderParameters renderParams) => new LineGeometry(renderParams.StartPoint, renderParams.EndPoint);
protected sealed override ShapeRenderData OnCreateImageRenderData(ShapeRenderParameters renderParams) => new ShapeRenderData(this.source.Geometry);