public void ContainsReturnsFalseIfItDoesNotContain() { var region = new SKRegion(new SKRectI(30, 30, 40, 40)); var region2 = new SKRegion(new SKRectI(25, 25, 50, 50)); Assert.False(region.Contains(region2)); }
public void ContainsReturnsTrueIfItDoesContain() { using var region = new SKRegion(new SKRectI(25, 25, 50, 50)); using var region2 = new SKRegion(new SKRectI(30, 30, 40, 40)); Assert.True(region.Contains(region2)); }
//Default resolution makes 10 points per line segment private bool IsInside(SKPath pInput, SKPath pBoundary) { var input = new SKRegion(); var boundary = new SKRegion(); input.SetRect(ToIntRect(pInput.Bounds)); boundary.SetRect(ToIntRect(pBoundary.Bounds)); input.SetPath(pInput); boundary.SetPath(pBoundary); var contained = boundary.Contains(input); return(contained); }
public bool HitTest(Point p, IShape shape) { var stroke = shape.Stroke; if (stroke is not null && stroke.Width < 4) { stroke = new Stroke(color: stroke.Color, width: 4); } using var path = new SKPath(); path.AddOval(shape.Bounds.ToSk()); using var paint = new SKPaint() .SetStroke(stroke) .SetFill(shape.Fill) .SetPaintStyle(stroke, shape.Fill); using var fillPath = paint.GetFillPath(path); using var region = new SKRegion(fillPath); return(region.Contains((int)p.X, (int)p.Y)); }
public bool IsVisible(Point pt) { return(skRegion.Contains(pt.X, pt.Y)); }
public void ContainsReturnsTrueIfItDoesContainPoint() { var region = new SKRegion(new SKRectI(25, 25, 50, 50)); Assert.True(region.Contains(40, 40)); }
public void ContainsReturnsFalseIfItDoesNotContainPoint() { var region = new SKRegion(new SKRectI(30, 30, 40, 40)); Assert.False(region.Contains(60, 60)); }