Beispiel #1
0
        public void ResizeFilterInUseHeightModeCalculatesDimensionsCorrectly()
        {
            // Arrange.
            var bitmap       = new FastBitmap(@"Resources\Tulips.png", UriKind.Relative);
            var resizeFilter = new ResizeFilter
            {
                Mode   = ResizeMode.UseHeight,
                Height = Unit.Pixel(200)
            };

            // Act.
            resizeFilter.ApplyFilter(bitmap);

            // Assert.
            Assert.AreEqual(300, bitmap.Width);
            Assert.AreEqual(200, bitmap.Height);
        }
Beispiel #2
0
        public void ResizeFilterInUseWidthModeWithDominantHeightCalculatesDimensionsCorrectly()
        {
            // Arrange.
            var bitmap       = new FastBitmap(@"Resources\Tulips.png", UriKind.Relative);
            var resizeFilter = new ResizeFilter
            {
                Mode   = ResizeMode.Uniform,
                Width  = Unit.Pixel(200),
                Height = Unit.Pixel(100)
            };

            // Act.
            resizeFilter.ApplyFilter(null, bitmap);

            // Assert.
            Assert.AreEqual(150, bitmap.Width);
            Assert.AreEqual(100, bitmap.Height);
        }