public override void Draw(SKCanvas canvas, RectangleF dirtyRect) { canvas.Clear(Color.Transparent.ToSKColor()); if (TypedVirtualView == null || drawMapper == null) { return; } canvas.Save(); var layers = LayerDrawingOrder(); var padding = this.GetPadding(); var rect = dirtyRect.ApplyPadding(padding); foreach (var layer in layers) { drawMapper.DrawLayer(canvas, rect, this, TypedVirtualView, layer); } var clipShape = VirtualView?.GetClipShape() ?? VirtualView?.GetBorder(); if (clipShape != null) { canvas.ClipPath(clipShape.PathForBounds(rect).ToSKPath()); } drawMapper.DrawLayer(canvas, rect, this, TypedVirtualView, SkiaEnvironmentKeys.Border); canvas.Restore(); }
protected bool DrawLayer(string key, SKCanvas canvas, RectangleF dirtyRect, SkiaControl viewHandler, TVirtualView virtualView) { if (this.TryGetValue(key, out var action)) { action?.Invoke(canvas, dirtyRect, viewHandler, virtualView); return(true); } else { return(_chained?.DrawLayer(key, canvas, dirtyRect, viewHandler, virtualView) ?? false); } }