public void SpanIteratorHasCorrectIntercepts() { var rectA = SKRectI.Create(10, 10, 100, 100); var rectB = SKRectI.Create(50, 50, 100, 100); using var region = new SKRegion(rectA); region.Op(rectB, SKRegionOperation.Union); using var iterator = region.CreateSpanIterator(30, 5, 200); Assert.True(iterator.Next(out var left, out var right)); Assert.Equal(10, left); Assert.Equal(110, right); Assert.False(iterator.Next(out left, out right)); Assert.Equal(0, left); Assert.Equal(0, right); Assert.False(iterator.Next(out left, out right)); Assert.Equal(0, left); Assert.Equal(0, right); }
public void ClipIteratorHasCorrectRects() { var rectA = SKRectI.Create(10, 10, 100, 100); var rectB = SKRectI.Create(50, 50, 100, 100); using var region = new SKRegion(rectA); region.Op(rectB, SKRegionOperation.Union); using var iterator = region.CreateClipIterator(SKRectI.Create(5, 5, 65, 65)); Assert.True(iterator.Next(out var rect)); Assert.Equal(SKRectI.Create(10, 10, 100, 40), rect); Assert.True(iterator.Next(out rect)); Assert.Equal(SKRectI.Create(10, 50, 140, 60), rect); Assert.False(iterator.Next(out rect)); Assert.Equal(SKRect.Empty, rect); Assert.False(iterator.Next(out rect)); Assert.Equal(SKRect.Empty, rect); }