Exemplo n.º 1
0
 public void RenderUnfilledElements(PlotRendererD2D canvas, System.Windows.Rect chartArea, System.Windows.Media.MatrixTransform PrimitiveTransform)
 {
     if (Points.Count > 0 && LineColor != System.Windows.Media.Colors.Transparent && LineThickness > 0)
     {
         GeometryAndFlag gnf = null;
         if (!_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf) || gnf.RecalcGeometry || gnf.Rect != chartArea)
         {
             CalculateGeometry(canvas.D2DFactory, chartArea);
         }
         if (_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf))
         {
             var transformedGeometry = new TransformedGeometry(canvas.D2DFactory, gnf.UnfilledGeometry, PrimitiveTransform.ToD2D());
             var brush = new SolidColorBrush(canvas.RenderTarget, LineColor.ToD2D());
             canvas.RenderTarget.DrawGeometry(transformedGeometry, brush, (float)LineThickness);
         }
     }
 }
        public void RenderUnfilledElements(PlotRendererD2D canvas, System.Windows.Rect chartArea, System.Windows.Media.MatrixTransform PrimitiveTransform)
        {
            GeometryAndFlag gnf = null;

            if (!_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf) || gnf.RecalcGeometry)
            {
                CalculateGeometry(canvas.D2DFactory, chartArea);
            }
            if (_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf))
            {
                int colorIndex = 0;
                foreach (var childGeometry in gnf.UnfilledGeometry)
                {
                    System.Windows.Media.Color lineColor = _colors[colorIndex].Item1;
                    if (lineColor != System.Windows.Media.Colors.Transparent)
                    {
                        var brush = new SolidColorBrush(canvas.RenderTarget, lineColor.ToD2D());
                        var transformedGeometry = new TransformedGeometry(canvas.D2DFactory, childGeometry, PrimitiveTransform.ToD2D());
                        canvas.RenderTarget.DrawGeometry(transformedGeometry, brush, (float)LineThickness);
                    }
                    ++colorIndex;
                }
            }
        }
 public void RenderFilledElements(PlotRendererD2D canvas, System.Windows.Rect chartArea, System.Windows.Media.MatrixTransform PrimitiveTransform)
 {
     if (this.FillColor != System.Windows.Media.Colors.Transparent)
     {
         GeometryAndFlag gnf = null;
         if (!_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf) || gnf.RecalcGeometry)
         {
             CalculateGeometry(canvas.D2DFactory, chartArea);
         }
         //Brush brush = IsDashed ? (Brush)(ChartUtilities.CreateHatch50(this.FillColor, new Size(2, 2))) : (Brush)(new SolidColorBrush(this.FillColor));
         if (_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf))
         {
             var transformedGeometry = new TransformedGeometry(canvas.D2DFactory, gnf.FilledGeometry, PrimitiveTransform.ToD2D());
             var brush = new SolidColorBrush(canvas.RenderTarget, FillColor.ToD2D());
             canvas.RenderTarget.FillGeometry(transformedGeometry, brush);
         }
     }
 }
Exemplo n.º 4
0
        public void RenderUnfilledElements(PlotRendererD2D canvas, System.Windows.Rect chartArea, System.Windows.Media.MatrixTransform PrimitiveTransform)
        {
            var storedTransform = canvas.RenderTarget.Transform;

            //canvas.RenderTarget.Transform = PrimitiveTransform.ToD2D();

            //for(int segmentIndex = 0; segmentIndex < _lineColors.Count; ++segmentIndex) {
            //  var brush = canvas.RenderTarget.CreateSolidColorBrush(_lineColors[segmentIndex].ToD2D());
            //  canvas.RenderTarget.DrawLine(Points[segmentIndex * 2].ToD2D(), Points[segmentIndex * 2 + 1].ToD2D(), brush, (float)LineThickness);
            //}
            //canvas.RenderTarget.Transform = storedTransform;


            if (this.LineColor != System.Windows.Media.Colors.Transparent && LineThickness > 0)
            {
                GeometryAndFlag gnf = null;
                if (!_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf) || gnf.RecalcGeometry)
                {
                    CalculateGeometry(canvas.D2DFactory, chartArea);
                }
                if (_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf))
                {
                    var transformedGeometry = new TransformedGeometry(canvas.D2DFactory, gnf.UnfilledGeometry, PrimitiveTransform.ToD2D());

                    var brush = new SolidColorBrush(canvas.RenderTarget, LineColor.ToD2D());

                    canvas.RenderTarget.DrawGeometry(transformedGeometry, brush, (float)LineThickness);
                }
            }
        }