Exemplo n.º 1
0
        /// <summary>
        /// Flips the current image either horizontally or vertically.
        /// </summary>
        /// <param name="flipVertically">
        /// Whether to flip the image vertically.
        /// </param>
        /// <param name="flipBoth">
        /// Whether to flip the image both vertically and horizontally.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory Flip(bool flipVertically = false, bool flipBoth = false)
        {
            if (this.ShouldProcess)
            {
                RotateFlipType rotateFlipType;
                if (flipBoth)
                {
                    rotateFlipType = RotateFlipType.RotateNoneFlipXY;
                }
                else
                {
                    rotateFlipType = flipVertically
                        ? RotateFlipType.RotateNoneFlipY
                        : RotateFlipType.RotateNoneFlipX;
                }

                Flip flip = new Flip { DynamicParameter = rotateFlipType };
                this.CurrentImageFormat.ApplyProcessor(flip.ProcessImage, this);
            }

            return this;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Flips the current image either horizontally or vertically.
        /// </summary>
        /// <param name="flipVertically">
        /// Whether to flip the image vertically.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory Flip(bool flipVertically)
        {
            if (this.ShouldProcess)
            {
                RotateFlipType rotateFlipType = flipVertically == false
                    ? RotateFlipType.RotateNoneFlipX
                    : RotateFlipType.RotateNoneFlipY;

                Flip flip = new Flip { DynamicParameter = rotateFlipType };

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

            return this;
        }