Пример #1
0
        public void EmptyRegionDoesNotIntersectsWithRectI()
        {
            var region = new SKRegion();

            var rect = new SKRectI(10, 20, 30, 40);

            Assert.False(region.Intersects(rect));
        }
Пример #2
0
        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));
        }
Пример #3
0
        /// <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));
        }
Пример #4
0
        /// <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));
        }
Пример #5
0
 public void Intersect(Region region)
 {
     skRegion.Intersects(region.skRegion);
 }