diff --git a/src/ImageProcessor/ImageProcessor.csproj b/src/ImageProcessor/ImageProcessor.csproj
index 601e16547..f28352c9e 100644
--- a/src/ImageProcessor/ImageProcessor.csproj
+++ b/src/ImageProcessor/ImageProcessor.csproj
@@ -110,6 +110,7 @@
+
diff --git a/src/ImageProcessor/Imaging/Filters/ComicMatrixFilter.cs b/src/ImageProcessor/Imaging/Filters/ComicMatrixFilter.cs
index 8b3463f91..3523217a1 100644
--- a/src/ImageProcessor/Imaging/Filters/ComicMatrixFilter.cs
+++ b/src/ImageProcessor/Imaging/Filters/ComicMatrixFilter.cs
@@ -9,12 +9,9 @@ namespace ImageProcessor.Imaging.Filters
{
#region Using
using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
using System.Drawing;
- using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
+ using System.Drawing.Imaging;
#endregion
///
@@ -49,7 +46,7 @@ namespace ImageProcessor.Imaging.Filters
}
///
- /// Gets the for this filter instance.
+ /// Gets the for this filter instance.
///
public ColorMatrix Matrix
{
diff --git a/src/ImageProcessor/Processors/Alpha.cs b/src/ImageProcessor/Processors/Alpha.cs
index 203e2c918..45c253fa8 100644
--- a/src/ImageProcessor/Processors/Alpha.cs
+++ b/src/ImageProcessor/Processors/Alpha.cs
@@ -22,7 +22,7 @@ namespace ImageProcessor.Processors
{
///
/// The regular expression to search strings for.
- /// http://stackoverflow.com/a/6400969/427899
+ ///
///
private static readonly Regex QueryRegex = new Regex(@"alpha=(?:100|[1-9]?[0-9])", RegexOptions.Compiled);
diff --git a/src/ImageProcessor/Processors/Crop.cs b/src/ImageProcessor/Processors/Crop.cs
index b90f5d33a..188da4201 100644
--- a/src/ImageProcessor/Processors/Crop.cs
+++ b/src/ImageProcessor/Processors/Crop.cs
@@ -23,7 +23,7 @@ namespace ImageProcessor.Processors
{
///
/// The regular expression to search strings for.
- /// http://stackoverflow.com/a/6400969/427899
+ ///
///
private static readonly Regex QueryRegex = new Regex(@"crop=\d+-\d+-\d+-\d+", RegexOptions.Compiled);
diff --git a/src/ImageProcessor/Processors/Filter.cs b/src/ImageProcessor/Processors/Filter.cs
index 98b871d3e..8efd88540 100644
--- a/src/ImageProcessor/Processors/Filter.cs
+++ b/src/ImageProcessor/Processors/Filter.cs
@@ -179,7 +179,6 @@ namespace ImageProcessor.Processors
if (matrix != null)
{
return matrix.ProcessImage(factory, image, newImage);
-
}
}
catch
diff --git a/src/ImageProcessor/Processors/Flip.cs b/src/ImageProcessor/Processors/Flip.cs
new file mode 100644
index 000000000..9f528ac08
--- /dev/null
+++ b/src/ImageProcessor/Processors/Flip.cs
@@ -0,0 +1,166 @@
+// -----------------------------------------------------------------------
+//
+// Copyright (c) James South.
+// Dual licensed under the MIT or GPL Version 2 licenses.
+//
+// -----------------------------------------------------------------------
+
+namespace ImageProcessor.Processors
+{
+ #region Using
+ using System.Collections.Generic;
+ using System.Drawing;
+ using System.Text.RegularExpressions;
+ #endregion
+
+ ///
+ /// Flips an image horizontally or vertically.
+ ///
+ public class Flip : IGraphicsProcessor
+ {
+ ///
+ /// The regular expression to search strings for.
+ ///
+ ///
+ private static readonly Regex QueryRegex = new Regex(@"flip=(horizontal|vertical)", RegexOptions.Compiled);
+
+ #region IGraphicsProcessor Members
+ ///
+ /// Gets the name.
+ ///
+ public string Name
+ {
+ get
+ {
+ return "Flip";
+ }
+ }
+
+ ///
+ /// Gets the description.
+ ///
+ public string Description
+ {
+ get
+ {
+ return "Flips an image either horizontally or vertically.";
+ }
+ }
+
+ ///
+ /// Gets the regular expression to search strings for.
+ ///
+ public Regex RegexPattern
+ {
+ get
+ {
+ return QueryRegex;
+ }
+ }
+
+ ///
+ /// Gets or sets DynamicParameter.
+ ///
+ public dynamic DynamicParameter
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets the order in which this processor is to be used in a chain.
+ ///
+ public int SortOrder
+ {
+ get;
+ private set;
+ }
+
+ ///
+ /// Gets or sets any additional settings required by the processor.
+ ///
+ public Dictionary Settings
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// The position in the original string where the first character of the captured substring was found.
+ ///
+ ///
+ /// The query string to search.
+ ///
+ ///
+ /// The zero-based starting position in the original string where the captured substring was found.
+ ///
+ public int MatchRegexIndex(string queryString)
+ {
+ int index = 0;
+
+ // Set the sort order to max to allow filtering.
+ this.SortOrder = int.MaxValue;
+
+ foreach (Match match in this.RegexPattern.Matches(queryString))
+ {
+ if (match.Success)
+ {
+ if (index == 0)
+ {
+ // Set the index on the first instance only.
+ this.SortOrder = match.Index;
+ string direction = match.Value;
+
+ this.DynamicParameter = direction == "horizontal"
+ ? RotateFlipType.RotateNoneFlipX
+ : RotateFlipType.RotateNoneFlipY;
+ }
+
+ index += 1;
+ }
+ }
+
+ return this.SortOrder;
+ }
+
+ ///
+ /// Processes the image.
+ ///
+ ///
+ /// The the current instance of the class containing
+ /// the image to process.
+ ///
+ ///
+ /// The processed image from the current instance of the class.
+ ///
+ public Image ProcessImage(ImageFactory factory)
+ {
+ Bitmap newImage = null;
+ Image image = factory.Image;
+
+ try
+ {
+ RotateFlipType rotateFlipType = this.DynamicParameter;
+
+ newImage = (Bitmap)image.Clone();
+
+ // Might not need this.
+ newImage.Tag = image.Tag;
+ newImage.RotateFlip(rotateFlipType);
+
+ image.Dispose();
+ image = newImage;
+ }
+ catch
+ {
+ if (newImage != null)
+ {
+ newImage.Dispose();
+ }
+ }
+
+ return image;
+ }
+ #endregion
+ }
+}
diff --git a/src/ImageProcessor/Processors/Rotate.cs b/src/ImageProcessor/Processors/Rotate.cs
index 35bb7b110..69110c228 100644
--- a/src/ImageProcessor/Processors/Rotate.cs
+++ b/src/ImageProcessor/Processors/Rotate.cs
@@ -200,11 +200,11 @@ namespace ImageProcessor.Processors
/// The image to rotate
/// The horizontal pixel coordinate at which to rotate the image.
/// The vertical pixel coordinate at which to rotate the image.
- /// The angle in degress at which to rotate the image.
+ /// The angle in degrees at which to rotate the image.
/// The background color to fill an image with.
/// The image rotated to the given angle at the given position.
///
- /// Based on http://www.codeproject.com/Articles/58815/C-Image-PictureBox-Rotations?msg=4155374#xx4155374xx
+ /// Based on
///
private Bitmap RotateImage(Image image, float rotateAtX, float rotateAtY, float angle, Color backgroundColor)
{