Encapsulates methods to rotate an image.
Наследование: IGraphicsProcessor
Пример #1
0
        /// <summary>
        /// Rotates the current image by the given angle.
        /// </summary>
        /// <param name="degrees">
        /// The angle at which to rotate the image in degrees.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory Rotate(float degrees)
        {
            if (this.ShouldProcess)
            {
                Rotate rotate = new Rotate { DynamicParameter = degrees };
                this.CurrentImageFormat.ApplyProcessor(rotate.ProcessImage, this);
            }

            return this;
        }
Пример #2
0
        /// <summary>
        /// Rotates the current image by the given angle.
        /// </summary>
        /// <param name="rotateLayer">
        /// The <see cref="T:ImageProcessor.Imaging.RotateLayer"/> containing the properties to rotate the image.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory Rotate(RotateLayer rotateLayer)
        {
            if (this.ShouldProcess)
            {
                // Sanitize the input.
                if (rotateLayer.Angle > 360 || rotateLayer.Angle < 0)
                {
                    rotateLayer.Angle = 0;
                }

                Rotate rotate = new Rotate { DynamicParameter = rotateLayer };

                this.Image = rotate.ProcessImage(this);
            }

            return this;
        }
        public void TestRotateRegex()
        {
            const string Querystring = "rotate=270";
            RotateLayer expected = new RotateLayer(270, Color.Transparent);

            Rotate rotate = new Rotate();
            rotate.MatchRegexIndex(Querystring);

            RotateLayer actual = rotate.DynamicParameter;

            Assert.AreEqual(expected, actual);
        }
        public void TestRotateRegex()
        {
            const string Querystring = "rotate=270";
            RotateLayer expected = new RotateLayer(270, Color.Transparent);

            Rotate rotate = new Rotate();
            rotate.MatchRegexIndex(Querystring);

            RotateLayer actual = rotate.DynamicParameter;

            // Can't use are equal on rotatelayer for some reason so test the two properties.
            Assert.AreEqual(expected.Angle, actual.Angle);
            Assert.AreEqual(expected.BackgroundColor, actual.BackgroundColor);
        }