public void EmptyRegionDoesNotIntersectsWithRectI() { var region = new SKRegion(); var rect = new SKRectI(10, 20, 30, 40); Assert.False(region.Intersects(rect)); }
public void RegionIntersectsWithRectI() { using var region = new SKRegion(); region.SetRect(new SKRectI(25, 25, 50, 50)); var rect = new SKRectI(10, 20, 30, 40); Assert.True(region.Intersects(rect)); }
/// <summary> /// Checks whether the region intersects the given path. /// </summary> /// <param name="region">The region to check collision with.</param> /// <param name="rect">The rectangle to check for intersection.</param> internal static bool IntersectsPath(this SKRegion region, SKPath path) { if (region.Bounds.IsEmpty) { return(false); } using SKRegion pathRegion = new SKRegion(); pathRegion.SetPath(path, region); return(region.Intersects(pathRegion)); }
/// <summary> /// Checks whether the region intersects the given rectangle. /// </summary> /// <param name="region">The region to check collision with.</param> /// <param name="rect">The rectangle to check for intersection.</param> internal static bool IntersectsRect(this SKRegion region, SKRect rect) { if (region.Bounds.IsEmpty) { return(false); } using SKRegion rectRegion = new SKRegion(); rectRegion.SetRect(SKRectI.Round(rect)); return(region.Intersects(rectRegion)); }
public void Intersect(Region region) { skRegion.Intersects(region.skRegion); }