protected internal void ClipRoundRect(SKRoundRect roundRect, IRectangleMask mask, DrawContext context) { var canvas = context.GetNativeCanvas <SkiaCanvasEx>(); using var layout = ShapeMaskLayout.Create(mask, roundRect.Rect.AsRectangleF(), context, false); canvas.ClipRoundRect(roundRect, mask.ClipMode.ToSkOperation()); }
public void Clip(IPathMask mask, DrawContext context) { if (!mask.IsActive || string.IsNullOrEmpty(mask.Data)) { return; } var path = PathBuilder.Build(mask.Data); //var bounds = path.Bounds; // Requires native GraphicsService var bounds = path.GetBoundsByFlattening(); using var layout = ShapeMaskLayout.Create(mask, bounds, context, false); context.Canvas.ClipPath(path); }
public void Clip(IPathMask mask, DrawContext context) { if (!mask.IsActive || string.IsNullOrEmpty(mask.Data)) { return; } using var path = SKPath.ParseSvgPathData(mask.Data); path.GetTightBounds(out var bounds); var canvas = context.GetNativeCanvas <SkiaCanvasEx>(); using var layout = ShapeMaskLayout.Create(mask, bounds.AsRectangleF(), context, true); canvas.ClipPath(path, mask.ClipMode.ToSkOperation()); }
public void Clip(IEllipseMask mask, DrawContext context) { if (!mask.IsActive) { return; } var bounds = mask.Size.GetDrawRectangle(context.CanvasRect, context.PixelScaling); var path = new PathF(); path.AppendEllipse(bounds); using var layout = ShapeMaskLayout.Create(mask, bounds, context, false); context.Canvas.ClipPath(path); }
public void Clip(IRectangleMask mask, DrawContext context) { if (!mask.IsActive) { return; } var bounds = mask.Size.GetDrawRectangle(context.CanvasRect, context.PixelScaling); var topLeft = GetCornerPoint(mask.Corners.TopLeft, bounds, context.PixelScaling); var topRight = GetCornerPoint(mask.Corners.TopRight, bounds, context.PixelScaling); var bottomLeft = GetCornerPoint(mask.Corners.BottomLeft, bounds, context.PixelScaling); var bottomRight = GetCornerPoint(mask.Corners.BottomRight, bounds, context.PixelScaling); var path = new PathF(); path.AppendRoundedRectangle(bounds, topLeft.X, topRight.X, bottomLeft.X, bottomRight.X); using var layout = ShapeMaskLayout.Create(mask, bounds, context, false); context.Canvas.ClipPath(path); }