/// <summary> /// Combines the region with a given path, specifying the operation used to combine. /// </summary> /// <param name="region">The region to perform the operation on.</param> /// <param name="path">The path to perform the operation with.</param> /// <param name="operation">The type of operation to perform.</param> /// <returns></returns> internal static bool CombineWithPath(this SKRegion region, SKPath path, SKRegionOperation operation) { using SKRegion pathRegion = new SKRegion(); pathRegion.SetPath(path, usePathBounds: true); return(region.Op(pathRegion, operation)); }
internal static bool Op(this SKRegion region, SKPath path, SKRegionOperation operation) { using (SKRegion pathRegion = new SKRegion()) { pathRegion.SetPath(path, true); return(region.Op(pathRegion, operation)); } }
public void ClipRegion(SKRegion region, SKPath path, SKRegionOperation regionOperation = SKRegionOperation.Intersect) { using (SKRegion region1 = new SKRegion()) { region1.SetPath(path); region.Op(region1, regionOperation); } }
public void ClipPath(SKPath path, SKRegionOperation operation = SKRegionOperation.Intersect, bool antialias = false) { if (path == null) { throw new ArgumentNullException(nameof(path)); } SkiaApi.sk_canvas_clip_path_with_operation(Handle, path.Handle, operation, antialias); }
void DisplayClipOp(SKCanvas canvas, SKRect rect, SKRegionOperation regionOp) { float textSize = textPaint.TextSize; canvas.DrawText(regionOp.ToString(), rect.MidX, rect.Top + textSize, textPaint); rect.Top += textSize; float radius = 0.9f * Math.Min(rect.Width / 3, rect.Height / 2); float xCenter = rect.MidX; float yCenter = rect.MidY; SKRectI recti = new SKRectI((int)rect.Left, (int)rect.Top, (int)rect.Right, (int)rect.Bottom); using (SKRegion wholeRectRegion = new SKRegion()) { wholeRectRegion.SetRect(recti); using (SKRegion region1 = new SKRegion(wholeRectRegion)) using (SKRegion region2 = new SKRegion(wholeRectRegion)) { using (SKPath path1 = new SKPath()) { path1.AddCircle(xCenter - radius / 2, yCenter, radius); region1.SetPath(path1); } using (SKPath path2 = new SKPath()) { path2.AddCircle(xCenter + radius / 2, yCenter, radius); region2.SetPath(path2); } region1.Op(region2, regionOp); canvas.Save(); canvas.ClipRegion(region1); canvas.DrawPaint(fillPaint); canvas.Restore(); } } }
public void ClipRect(SKRect rect, SKRegionOperation operation = SKRegionOperation.Intersect, bool antialias = false) { SkiaApi.sk_canvas_clip_rect_with_operation (Handle, ref rect, operation, antialias); }
public void ClipPath(SKPath path, SKRegionOperation operation = SKRegionOperation.Intersect, bool antialias = false) { if (path == null) throw new ArgumentNullException (nameof (path)); SkiaApi.sk_canvas_clip_path_with_operation (Handle, path.Handle, operation, antialias); }
public bool Op(SKRegion region, SKRegionOperation op) { return(SkiaApi.sk_region_op2(Handle, region.Handle, op)); }
public extern static bool sk_region_op2(sk_region_t r, sk_region_t src, SKRegionOperation op);
public bool Op(SKRegion region, SKRegionOperation op) => SkiaApi.sk_region_op2(Handle, region.Handle, op);
public bool Op(SKRectI rect, SKRegionOperation op) => SkiaApi.sk_region_op(Handle, rect.Left, rect.Top, rect.Right, rect.Bottom, op);
public void ClipPath (SKPath path, SKRegionOperation operation, bool antialias = false) { ClipPath (path, (SKClipOperation)(int)operation, antialias); }
public void ClipRect (SKRect rect, SKRegionOperation operation, bool antialias = false) { ClipRect (rect, (SKClipOperation)(int)operation, antialias); }
public void ClipRect(SKRect rect, SKRegionOperation operation = SKRegionOperation.Intersect, bool antialias = false) { SkiaApi.sk_canvas_clip_rect_with_operation(Handle, ref rect, operation, antialias); }
public void ClipRect(SKRect rect, SKRegionOperation operation, bool antialias = false) { ClipRect(rect, (SKClipOperation)(int)operation, antialias); }
public bool Op(SKRegion region, SKRegionOperation op) { return SkiaApi.sk_region_op2(Handle, region.Handle, op); }
public void ClipPath(SKPath path, SKRegionOperation operation, bool antialias = false) { ClipPath(path, (SKClipOperation)(int)operation, antialias); }
public bool Op(SKRectI rect, SKRegionOperation op) { return SkiaApi.sk_region_op(Handle, rect.Left, rect.Top, rect.Right, rect.Bottom, op); }
public bool Op(int left, int top, int right, int bottom, SKRegionOperation op) => SkiaApi.sk_region_op(Handle, left, top, right, bottom, op);
public bool Op(int left, int top, int right, int bottom, SKRegionOperation op) { return SkiaApi.sk_region_op(Handle, left, top, right, bottom, op); }
public bool Op(SKPath path, SKRegionOperation op) { using (var pathRegion = new SKRegion(path)) { return(Op(pathRegion, op)); } }
public extern static bool sk_region_op(sk_region_t r, int left, int top, int right, int bottom, SKRegionOperation op);