public void RenderFilledElements(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.FilledGeometry)
                {
                    System.Windows.Media.Color fillColor = _colors[colorIndex].Item2;
                    if (fillColor != System.Windows.Media.Colors.Transparent)
                    {
                        //Brush brush = IsDashed ? (Brush)(ChartUtilities.CreateHatch50(fillColor, new Size(2, 2))) : (Brush)(new SolidColorBrush(fillColor));
                        var brush = new SolidColorBrush(canvas.RenderTarget, fillColor.ToD2D());
                        var transformedGeometry = new TransformedGeometry(canvas.D2DFactory, childGeometry, PrimitiveTransform.ToD2D());
                        canvas.RenderTarget.FillGeometry(transformedGeometry, brush);
                    }
                    ++colorIndex;
                }
            }
        }
Beispiel #2
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);
                }
            }
        }
Beispiel #3
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);
         }
     }
 }
Beispiel #4
0
        void ChartControlD2D_Loaded(object sender, RoutedEventArgs e)
        {
            this.Loaded -= ChartControlD2D_Loaded;
            Window parentWindow = Window.GetWindow(this);

            _plotCanvasD2D = new PlotRendererD2D();
            _plotCanvasD2D.Initialize(parentWindow);
            if (_plotCanvasD2D.IsValid)
            {
                // Disable and replace the WPF renderer
                _plotRenderer.PrimitiveList = null;

                _plotCanvasD2D.PrimitiveList      = _primitiveList;
                _plotCanvasD2D.PrimitiveTransform = _shapeTransform;
                _plotRenderer     = _plotCanvasD2D;
                _imageHost.Source = _plotCanvasD2D.ImageSource;
                OnPlotResized();
            }
        }
        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;
                }
            }
        }
Beispiel #6
0
 public void RenderFilledElements(PlotRendererD2D canvas, System.Windows.Rect chartArea, System.Windows.Media.MatrixTransform PrimitiveTransform)
 {
 }