private void InitializeAllShapePropertyValues(IEnumerable <KeyValuePair <PaintDotNet.Shapes.ShapeInfo, IDictionary <object, object> > > allShapePropertyValues) { if (allShapePropertyValues == null) { this.allShapePropertyValuesArray = null; this.allShapePropertyValuesMap = null; } else { this.allShapePropertyValuesArray = ShapePropertyValuesUtil.ToTable(allShapePropertyValues).ToArrayEx <TupleStruct <PaintDotNet.Shapes.ShapeInfo, object, object> >(); this.allShapePropertyValuesMap = ShapePropertyValuesUtil.ToReadOnlyMap(this.allShapePropertyValuesArray); } }
private void Initialize() { if ((this.allShapePropertyValuesMap == null) && (this.allShapePropertyValuesArray != null)) { this.allShapePropertyValuesMap = ShapePropertyValuesUtil.ToReadOnlyMap(this.allShapePropertyValuesArray); } PaintDotNet.UI.Media.DashStyle style = DashStyleUtil.ToMedia(this.PenDashStyle); this.outlinePen = new Pen { Brush = SolidColorBrushCache.Get((ColorRgba128Float)Colors.White), Thickness = this.PenWidth, LineJoin = PenLineJoin.Miter, DashStyle = style }.EnsureFrozen <Pen>(); RectDouble baseBounds = this.BaseBounds; VectorDouble txScale = this.Transform.GetScale(); VectorDouble num3 = (VectorDouble)(this.EndPoint - this.StartPoint); PointDouble endPoint = new PointDouble(this.StartPoint.X + (num3.X * txScale.X), this.StartPoint.Y + (num3.Y * txScale.Y)); Dictionary <string, object> settingValues = (from gsp in this.Shape.RenderSettingPaths select KeyValuePairUtil.Create <string, object>(gsp, base.GetDrawingSettingValue(gsp))).ToDictionary <string, object>(); PaintDotNet.Shapes.ShapeRenderParameters renderParams = new PaintDotNet.Shapes.ShapeRenderParameters(this.StartPoint, endPoint, txScale, settingValues, null); this.shapePropertySchema = this.Shape.CreatePropertyCollection(renderParams); foreach (Property property in this.shapePropertySchema) { property.ValueChanged += delegate(object s, ValueEventArgs <object> e) { throw new ReadOnlyException(); }; property.ReadOnlyChanged += delegate(object s, ValueEventArgs <bool> e) { throw new ReadOnlyException(); }; } this.shapeRenderParams = new PaintDotNet.Shapes.ShapeRenderParameters(this.StartPoint, endPoint, txScale, settingValues, this.ShapePropertyValues); this.shapeRenderData = LazyResult.New <PaintDotNet.Shapes.ShapeRenderData>(delegate { PaintDotNet.Shapes.ShapeRenderData renderData = this.Shape.CreateRenderData(this.shapeRenderParams); Matrix3x2Double matrix = Matrix3x2Double.ScalingAt(1.0 / Math.Abs(txScale.X), 1.0 / Math.Abs(txScale.Y), this.StartPoint.X, this.StartPoint.Y); return(PaintDotNet.Shapes.ShapeRenderData.Transform(PaintDotNet.Shapes.ShapeRenderData.Transform(renderData, matrix), this.transform)); }, LazyThreadSafetyMode.ExecutionAndPublication, new SingleUseCriticalSection()); }