public void Draw(object context, double width, double height, double dx, double dy, double zx, double zy)
 {
     using (var renderer = new SkiaShapeRenderer(_context, _view, _view.SelectionState))
         using (var disposable = new CompositeDisposable())
             using (var background = SkiaHelper.ToSKPaint(_view.PrintBackground, null, zx, disposable.Disposables))
             {
                 var canvas = context as SKCanvas;
                 canvas.DrawRect(SkiaHelper.ToSKRect(dx, dy, _view.Width + dx, _view.Height + dy), background);
                 _view.CurrentContainer.Draw(canvas, renderer, dx, dy, zx, null, null);
             }
 }
        private void GetSKPaintFill(IPaint fillPaint, IPaintEffects effects, double scale, out SKPaint brush)
        {
            if (fillPaint.IsTreeDirty() || !_paintCache.TryGetValue(fillPaint, out var brushCached))
            {
                fillPaint.Invalidate();
                brushCached            = SkiaHelper.ToSKPaint(fillPaint, effects, scale, _disposable.Disposables);
                _paintCache[fillPaint] = brushCached;
            }
            else
            {
                SkiaHelper.ToSKPaintUpdate(brushCached, fillPaint, effects, scale, _disposable.Disposables);
            }

            brush = brushCached;
        }
Beispiel #3
0
        public void Draw(object context, double width, double height, double dx, double dy, double zx, double zy)
        {
            using (var renderer = new SkiaShapeRenderer(_context, _view, _view.SelectionState))
                using (var disposable = new CompositeDisposable())
                    using (var background = SkiaHelper.ToSKPaint(_view.PrintBackground, null, zx, disposable.Disposables))
                    {
                        var canvas = context as SKCanvas;
                        canvas.DrawRect(SkiaHelper.ToSKRect(dx, dy, _view.Width + dx, _view.Height + dy), background);

                        var selected = new List <IBaseShape>(_view.SelectionState?.Shapes);
                        foreach (var shape in selected)
                        {
                            if (IsAcceptedShape(shape))
                            {
                                shape.Draw(canvas, renderer, dx, dy, zx, null, null);
                            }
                        }
                    }
        }