public void Rotate_degreesFloat_RotateProcessorWithAnglesSetrue(RotateType angle, FlipType flip, float expectedAngle)
        {
            this.operations.RotateFlip(angle, flip);
            RotateProcessor <Rgba32> rotateProcessor = this.Verify <RotateProcessor <Rgba32> >(0);
            FlipProcessor <Rgba32>   flipProcessor   = this.Verify <FlipProcessor <Rgba32> >(1);

            Assert.Equal(expectedAngle, rotateProcessor.Degrees);
            Assert.Equal(flip, flipProcessor.FlipType);
        }
示例#2
0
        public void RotateDegreesFloatRotateProcessorWithAnglesSet(RotateMode angle, FlipMode flip, float expectedAngle)
        {
            this.operations.RotateFlip(angle, flip);
            RotateProcessor rotateProcessor = this.Verify <RotateProcessor>(0);
            FlipProcessor   flipProcessor   = this.Verify <FlipProcessor>(1);

            Assert.Equal(expectedAngle, rotateProcessor.Degrees);
            Assert.Equal(flip, flipProcessor.FlipMode);
        }
示例#3
0
        /// <summary>
        /// Flips an image by the given instructions.
        /// </summary>
        /// <typeparam name="T">The pixel format.</typeparam>
        /// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
        /// <param name="source">The image to rotate, flip, or both.</param>
        /// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param>
        /// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
        /// <returns>The <see cref="Image"/></returns>
        public static Image <T, TP> Flip <T, TP>(this Image <T, TP> source, FlipType flipType, ProgressEventHandler progressHandler = null)
            where T : IPackedVector <TP>
            where TP : struct
        {
            FlipProcessor <T, TP> processor = new FlipProcessor <T, TP>(flipType);

            processor.OnProgress += progressHandler;

            try
            {
                return(source.Process(source.Width, source.Height, source.Bounds, source.Bounds, processor));
            }
            finally
            {
                processor.OnProgress -= progressHandler;
            }
        }