public void RegionImageSize() { var rect = new Rectangle(0, 0, 100, 100); using (var imgProvider = new RegionProvider(rect, false)) { Assert.Equal(imgProvider.Width, rect.Width); Assert.Equal(imgProvider.Height, rect.Height); using (var img = imgProvider.Capture()) { Assert.Equal(img.Width, rect.Width); Assert.Equal(img.Height, rect.Height); } } }
public void RegionImageSizeOdd() { var rect = new Rectangle(0, 0, 101, 53); using (var imgProvider = new RegionProvider(rect, false)) { Assert.True(imgProvider.Width % 2 == 0); Assert.True(imgProvider.Height % 2 == 0); using (var img = imgProvider.Capture()) { Assert.Equal(img.Width, imgProvider.Width); Assert.Equal(img.Height, imgProvider.Height); Assert.True(img.Width % 2 == 0); Assert.True(img.Height % 2 == 0); } } }
public Bitmap Capture() { _regionProvider.UpdateLocation(_selector.SelectedRegion.Location); return(_regionProvider.Capture()); }