Пример #1
0
        public void Should_switch_dimensions_when_rotation_is_90_or_270_degrees(ImageRotation rotation)
        {
            var source         = new MyImage(2, 4);
            var transformation = new RotateTransformation(rotation);
            var actual         = transformation.Process(source);

            Check.That(actual.Width).IsEqualTo(source.Height);
            Check.That(actual.Height).IsEqualTo(source.Width);
        }
Пример #2
0
        public void Should_move_pixels_when_doing_a_270_degrees_rotation()
        {
            var source         = new MyImage(TestImages.ImageWithAllDifferentPixels);
            var transformation = new RotateTransformation(ImageRotation.Clockwise270);
            var actual         = transformation.Process(source);

            Check.That(actual[0, 0]).IsEqualTo(source[0, source.Width - 1]);
            Check.That(actual[0, actual.Width - 1]).IsEqualTo(source[source.Height - 1, source.Width - 1]);
            Check.That(actual[actual.Height - 1, 0]).IsEqualTo(source[0, 0]);
            Check.That(actual[actual.Height - 1, actual.Width - 1]).IsEqualTo(source[source.Height - 1, 0]);
        }