Browse Source

Merge remote-tracking branch 'origin/dev'

Former-commit-id: bd798056317419a55fc7f12eaf641c5c31e87c3c
af/merge-core
James South 12 years ago
parent
commit
d20300eee1
  1. 14
      src/ImageProcessor/Extensions/IntegerExtensions.cs
  2. 4
      src/ImageProcessor/Extensions/StringExtensions.cs
  3. 3
      src/ImageProcessor/Processors/Alpha.cs
  4. 3
      src/ImageProcessor/Processors/Brightness.cs
  5. 3
      src/ImageProcessor/Processors/Contrast.cs
  6. 7
      src/ImageProcessor/Processors/GaussianBlur.cs
  7. 7
      src/ImageProcessor/Processors/GaussianSharpen.cs
  8. 3
      src/ImageProcessor/Processors/Quality.cs
  9. 5
      src/ImageProcessor/Processors/Resize.cs
  10. 5
      src/ImageProcessor/Processors/Rotate.cs
  11. 5
      src/ImageProcessor/Processors/RoundedCorners.cs
  12. 3
      src/ImageProcessor/Processors/Saturation.cs
  13. 5
      src/ImageProcessor/Processors/Watermark.cs
  14. 4
      src/ImageProcessor/Properties/AssemblyInfo.cs
  15. 1
      src/Nuget/ImageProcessor.1.8.6.1.nupkg.REMOVED.git-id

14
src/ImageProcessor/Extensions/IntegerExtensions.cs

@ -10,6 +10,8 @@
namespace ImageProcessor.Extensions namespace ImageProcessor.Extensions
{ {
using System.Globalization;
/// <summary> /// <summary>
/// Encapsulates a series of time saving extension methods to the <see cref="T:System.Int32"/> class. /// Encapsulates a series of time saving extension methods to the <see cref="T:System.Int32"/> class.
/// </summary> /// </summary>
@ -32,5 +34,17 @@ namespace ImageProcessor.Extensions
{ {
return ((double)integer).ToByte(); return ((double)integer).ToByte();
} }
/// <summary>
/// Converts the string representation of a number in a specified culture-specific format to its
/// 32-bit signed integer equivalent using invariant culture.
/// </summary>
/// <param name="integer">The integer.</param>
/// <param name="s">A string containing a number to convert.</param>
/// <returns>A 32-bit signed integer equivalent to the number specified in s.</returns>
public static int ParseInvariant(this int integer, string s)
{
return int.Parse(s, CultureInfo.InvariantCulture);
}
} }
} }

4
src/ImageProcessor/Extensions/StringExtensions.cs

@ -134,7 +134,7 @@ namespace ImageProcessor.Extensions
// Loop and parse the int values. // Loop and parse the int values.
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
matches[i] = int.Parse(matchCollection[i].Value); matches[i] = int.Parse(matchCollection[i].Value, CultureInfo.InvariantCulture);
} }
return matches; return matches;
@ -163,7 +163,7 @@ namespace ImageProcessor.Extensions
// Loop and parse the int values. // Loop and parse the int values.
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
matches[i] = float.Parse(matchCollection[i].Value); matches[i] = float.Parse(matchCollection[i].Value, CultureInfo.InvariantCulture);
} }
return matches; return matches;

3
src/ImageProcessor/Processors/Alpha.cs

@ -14,6 +14,7 @@ namespace ImageProcessor.Processors
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
#endregion #endregion
@ -91,7 +92,7 @@ namespace ImageProcessor.Processors
{ {
// Set the index on the first instance only. // Set the index on the first instance only.
this.SortOrder = match.Index; this.SortOrder = match.Index;
int percentage = int.Parse(match.Value.Split('=')[1]); int percentage = int.Parse(match.Value.Split('=')[1], CultureInfo.InvariantCulture);
this.DynamicParameter = percentage; this.DynamicParameter = percentage;
} }

3
src/ImageProcessor/Processors/Brightness.cs

@ -14,6 +14,7 @@ namespace ImageProcessor.Processors
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
#endregion #endregion
@ -91,7 +92,7 @@ namespace ImageProcessor.Processors
{ {
// Set the index on the first instance only. // Set the index on the first instance only.
this.SortOrder = match.Index; this.SortOrder = match.Index;
int percentage = int.Parse(match.Value.Split('=')[1]); int percentage = int.Parse(match.Value.Split('=')[1], CultureInfo.InvariantCulture);
this.DynamicParameter = percentage; this.DynamicParameter = percentage;
} }

3
src/ImageProcessor/Processors/Contrast.cs

@ -14,6 +14,7 @@ namespace ImageProcessor.Processors
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
#endregion #endregion
@ -91,7 +92,7 @@ namespace ImageProcessor.Processors
{ {
// Set the index on the first instance only. // Set the index on the first instance only.
this.SortOrder = match.Index; this.SortOrder = match.Index;
int percentage = int.Parse(match.Value.Split('=')[1]); int percentage = int.Parse(match.Value.Split('=')[1], CultureInfo.InvariantCulture);
this.DynamicParameter = percentage; this.DynamicParameter = percentage;
} }

7
src/ImageProcessor/Processors/GaussianBlur.cs

@ -13,6 +13,7 @@ namespace ImageProcessor.Processors
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using ImageProcessor.Imaging; using ImageProcessor.Imaging;
@ -98,9 +99,9 @@ namespace ImageProcessor.Processors
double maxSigma; double maxSigma;
int maxThreshold; int maxThreshold;
int.TryParse(this.Settings["MaxSize"], out maxSize); int.TryParse(this.Settings["MaxSize"], NumberStyles.Any, CultureInfo.InvariantCulture, out maxSize);
double.TryParse(this.Settings["MaxSigma"], out maxSigma); double.TryParse(this.Settings["MaxSigma"], NumberStyles.Any, CultureInfo.InvariantCulture, out maxSigma);
int.TryParse(this.Settings["MaxThreshold"], out maxThreshold); int.TryParse(this.Settings["MaxThreshold"], NumberStyles.Any, CultureInfo.InvariantCulture, out maxThreshold);
int size = this.ParseBlur(match.Value); int size = this.ParseBlur(match.Value);
double sigma = this.ParseSigma(match.Value); double sigma = this.ParseSigma(match.Value);

7
src/ImageProcessor/Processors/GaussianSharpen.cs

@ -13,6 +13,7 @@ namespace ImageProcessor.Processors
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using ImageProcessor.Imaging; using ImageProcessor.Imaging;
@ -98,9 +99,9 @@ namespace ImageProcessor.Processors
double maxSigma; double maxSigma;
int maxThreshold; int maxThreshold;
int.TryParse(this.Settings["MaxSize"], out maxSize); int.TryParse(this.Settings["MaxSize"], NumberStyles.Any, CultureInfo.InvariantCulture, out maxSize);
double.TryParse(this.Settings["MaxSigma"], out maxSigma); double.TryParse(this.Settings["MaxSigma"], NumberStyles.Any, CultureInfo.InvariantCulture, out maxSigma);
int.TryParse(this.Settings["MaxThreshold"], out maxThreshold); int.TryParse(this.Settings["MaxThreshold"], NumberStyles.Any, CultureInfo.InvariantCulture, out maxThreshold);
int size = this.ParseSharpen(match.Value); int size = this.ParseSharpen(match.Value);
double sigma = this.ParseSigma(match.Value); double sigma = this.ParseSigma(match.Value);

3
src/ImageProcessor/Processors/Quality.cs

@ -13,6 +13,7 @@ namespace ImageProcessor.Processors
#region Using #region Using
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
#endregion #endregion
@ -89,7 +90,7 @@ namespace ImageProcessor.Processors
{ {
// Set the index on the first instance only. // Set the index on the first instance only.
this.SortOrder = match.Index; this.SortOrder = match.Index;
int percentage = int.Parse(match.Value.Split('=')[1]); int percentage = int.Parse(match.Value.Split('=')[1], CultureInfo.InvariantCulture);
this.DynamicParameter = percentage; this.DynamicParameter = percentage;
} }

5
src/ImageProcessor/Processors/Resize.cs

@ -16,6 +16,7 @@ namespace ImageProcessor.Processors
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -179,8 +180,8 @@ namespace ImageProcessor.Processors
int defaultMaxHeight; int defaultMaxHeight;
string restrictions; string restrictions;
this.Settings.TryGetValue("RestrictTo", out restrictions); this.Settings.TryGetValue("RestrictTo", out restrictions);
int.TryParse(this.Settings["MaxWidth"], out defaultMaxWidth); int.TryParse(this.Settings["MaxWidth"], NumberStyles.Any, CultureInfo.InvariantCulture, out defaultMaxWidth);
int.TryParse(this.Settings["MaxHeight"], out defaultMaxHeight); int.TryParse(this.Settings["MaxHeight"], NumberStyles.Any, CultureInfo.InvariantCulture, out defaultMaxHeight);
List<Size> restrictedSizes = this.ParseRestrictions(restrictions); List<Size> restrictedSizes = this.ParseRestrictions(restrictions);
return this.ResizeImage(factory, width, height, defaultMaxWidth, defaultMaxHeight, restrictedSizes, backgroundColor, mode, anchor, upscale, centerCoordinates); return this.ResizeImage(factory, width, height, defaultMaxWidth, defaultMaxHeight, restrictedSizes, backgroundColor, mode, anchor, upscale, centerCoordinates);

5
src/ImageProcessor/Processors/Rotate.cs

@ -15,6 +15,7 @@ namespace ImageProcessor.Processors
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using ImageProcessor.Imaging; using ImageProcessor.Imaging;
#endregion #endregion
@ -114,7 +115,7 @@ namespace ImageProcessor.Processors
else else
{ {
int degrees; int degrees;
int.TryParse(match.Value.Split('=')[1], out degrees); int.TryParse(match.Value.Split('=')[1], NumberStyles.Any, CultureInfo.InvariantCulture, out degrees);
rotateLayer = new RotateLayer(degrees); rotateLayer = new RotateLayer(degrees);
} }
@ -281,7 +282,7 @@ namespace ImageProcessor.Processors
{ {
// Split on angle- // Split on angle-
int angle; int angle;
int.TryParse(match.Value.Split('-')[1], out angle); int.TryParse(match.Value.Split('-')[1], NumberStyles.Any, CultureInfo.InvariantCulture, out angle);
return angle; return angle;
} }

5
src/ImageProcessor/Processors/RoundedCorners.cs

@ -14,6 +14,7 @@ namespace ImageProcessor.Processors
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using ImageProcessor.Imaging; using ImageProcessor.Imaging;
#endregion #endregion
@ -133,7 +134,7 @@ namespace ImageProcessor.Processors
else else
{ {
int radius; int radius;
int.TryParse(match.Value.Split('=')[1], out radius); int.TryParse(match.Value.Split('=')[1], NumberStyles.Any, CultureInfo.InvariantCulture, out radius);
roundedCornerLayer = new RoundedCornerLayer(radius, this.ParseCorner(TopLeftRegex, toParse), this.ParseCorner(TopRightRegex, toParse), this.ParseCorner(BottomLeftRegex, toParse), this.ParseCorner(BottomRightRegex, toParse)); roundedCornerLayer = new RoundedCornerLayer(radius, this.ParseCorner(TopLeftRegex, toParse), this.ParseCorner(TopRightRegex, toParse), this.ParseCorner(BottomLeftRegex, toParse), this.ParseCorner(BottomRightRegex, toParse));
} }
@ -295,7 +296,7 @@ namespace ImageProcessor.Processors
{ {
// Split on radius- // Split on radius-
int radius; int radius;
int.TryParse(match.Value.Split('-')[1], out radius); int.TryParse(match.Value.Split('-')[1], NumberStyles.Any, CultureInfo.InvariantCulture, out radius);
return radius; return radius;
} }

3
src/ImageProcessor/Processors/Saturation.cs

@ -14,6 +14,7 @@ namespace ImageProcessor.Processors
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
#endregion #endregion
@ -95,7 +96,7 @@ namespace ImageProcessor.Processors
{ {
// Set the index on the first instance only. // Set the index on the first instance only.
this.SortOrder = match.Index; this.SortOrder = match.Index;
int percentage = int.Parse(match.Value.Split('=')[1]); int percentage = int.Parse(match.Value.Split('=')[1], CultureInfo.InvariantCulture);
this.DynamicParameter = percentage; this.DynamicParameter = percentage;
} }

5
src/ImageProcessor/Processors/Watermark.cs

@ -16,6 +16,7 @@ namespace ImageProcessor.Processors
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Text; using System.Drawing.Text;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -370,7 +371,7 @@ namespace ImageProcessor.Processors
foreach (Match match in FontSizeRegex.Matches(input)) foreach (Match match in FontSizeRegex.Matches(input))
{ {
// split on size-value // split on size-value
return int.Parse(match.Value.Split('-')[1]); return int.Parse(match.Value.Split('-')[1], CultureInfo.InvariantCulture);
} }
// Matches the default number in TextLayer. // Matches the default number in TextLayer.
@ -449,7 +450,7 @@ namespace ImageProcessor.Processors
foreach (Match match in OpacityRegex.Matches(input)) foreach (Match match in OpacityRegex.Matches(input))
{ {
// split on opacity- // split on opacity-
return int.Parse(match.Value.Split('-')[1]); return int.Parse(match.Value.Split('-')[1], CultureInfo.InvariantCulture);
} }
// full opacity - matches the Textlayer default. // full opacity - matches the Textlayer default.

4
src/ImageProcessor/Properties/AssemblyInfo.cs

@ -32,6 +32,6 @@ using System.Security;
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.8.6.0")] [assembly: AssemblyVersion("1.8.6.1")]
[assembly: AssemblyFileVersion("1.8.6.0")] [assembly: AssemblyFileVersion("1.8.6.1")]

1
src/Nuget/ImageProcessor.1.8.6.1.nupkg.REMOVED.git-id

@ -0,0 +1 @@
9057207691dbc6401636b864351771e96c9a4eae
Loading…
Cancel
Save