예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
        public Bitmap Capture()
        {
            _regionProvider.UpdateLocation(_selector.SelectedRegion.Location);

            return(_regionProvider.Capture());
        }