Browse Source

Versions, 1.9.0, 3.2.3, 1.1.0

Adding animated gif support
Adding Tint Method


Former-commit-id: 872138e10c1c593642ade1311c4fb2ff68c12b68
af/merge-core
James South 12 years ago
parent
commit
4c6cd99482
  1. 6
      build/Build.bat
  2. 12
      build/NuSpecs/ImageProcessor.Web.Config.nuspec
  3. 4
      build/NuSpecs/ImageProcessor.Web.nuspec
  4. 2
      build/NuSpecs/ImageProcessor.nuspec
  5. 7
      src/ImageProcessor.Tests/RegularExpressionUnitTests.cs
  6. 16
      src/ImageProcessor.Web/NET45/HttpModules/ImageProcessingModule.cs
  7. 4
      src/ImageProcessor.Web/NET45/Properties/AssemblyInfo.cs
  8. 1
      src/ImageProcessor/Extensions/ImageExtensions.cs
  9. 42
      src/ImageProcessor/Imaging/CropLayer.cs
  10. 9
      src/ImageProcessor/Imaging/RoundedCornerLayer.cs
  11. 4
      src/ImageProcessor/Properties/AssemblyInfo.cs
  12. 9
      src/ImageProcessorConsole/Program.cs
  13. 16
      src/Web.Test/LoadTest1.loadtest

6
build/Build.bat

@ -1,7 +1,7 @@
@ECHO OFF @ECHO OFF
SET version=1.8.8.0 SET version=1.9.0.0
SET webversion=3.2.2.0 SET webversion=3.2.3.0
SET webconfigversion=1.0.0.0 SET webconfigversion=1.1.0.0
ECHO Building ImageProcessor %version%, ImageProcess.Web %webversion% and ImageProcess.Web.Config %webconfigversion% ECHO Building ImageProcessor %version%, ImageProcess.Web %webversion% and ImageProcess.Web.Config %webconfigversion%

12
build/NuSpecs/ImageProcessor.Web.Config.nuspec

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>ImageProcessor.Web.Config</id> <id>ImageProcessor.Web.Config</id>
<version>1.0.0.0</version> <version>1.1.0.0</version>
<title>ImageProcessor.Web.Config</title> <title>ImageProcessor.Web.Config</title>
<authors>James South</authors> <authors>James South</authors>
<owners>James South</owners> <owners>James South</owners>
@ -19,6 +19,16 @@ Feedback is always welcome</description>
<copyright>James South</copyright> <copyright>James South</copyright>
<language>en-GB</language> <language>en-GB</language>
<tags>Image Imaging ASP Performance Processing HttpModule Cache Resize Rotate RoundedCorners Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg Bitmap Png Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated</tags> <tags>Image Imaging ASP Performance Processing HttpModule Cache Resize Rotate RoundedCorners Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg Bitmap Png Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated</tags>
<dependencies>
<group targetFramework=".NETFramework4.0">
<dependency id="ImageProcessor" version="1.9.0.0" />
<dependency id="ImageProcessor.Web" version="3.2.3.0" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="1.9.0.0" />
<dependency id="ImageProcessor.Web" version="3.2.3.0" />
</group>
</dependencies>
</metadata> </metadata>
<files> <files>
<file src="..\..\src\ImageProcessor.Web\NET45\Config\Resources\cache.config" target="content\config\imageprocessor\cache.config" /> <file src="..\..\src\ImageProcessor.Web\NET45\Config\Resources\cache.config" target="content\config\imageprocessor\cache.config" />

4
build/NuSpecs/ImageProcessor.Web.nuspec

@ -28,11 +28,11 @@ Feedback is always welcome</description>
<dependency id="Microsoft.Bcl.Async" version="1.0.168" /> <dependency id="Microsoft.Bcl.Async" version="1.0.168" />
<dependency id="Microsoft.Bcl" version="1.1.8" /> <dependency id="Microsoft.Bcl" version="1.1.8" />
<dependency id="Microsoft.Web.Infrastructure" version="1.0.0.0" /> <dependency id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
<dependency id="ImageProcessor" version="1.8.8.0" /> <dependency id="ImageProcessor" version="1.9.0.0" />
</group> </group>
<group targetFramework=".NETFramework4.5"> <group targetFramework=".NETFramework4.5">
<dependency id="Microsoft.Web.Infrastructure" version="1.0.0.0" /> <dependency id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
<dependency id="ImageProcessor" version="1.8.8.0" /> <dependency id="ImageProcessor" version="1.9.0.0" />
</group> </group>
</dependencies> </dependencies>
</metadata> </metadata>

2
build/NuSpecs/ImageProcessor.nuspec

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>ImageProcessor</id> <id>ImageProcessor</id>
<version>1.8.8.0</version> <version>1.9.0.0</version>
<title>ImageProcessor</title> <title>ImageProcessor</title>
<authors>James South</authors> <authors>James South</authors>
<owners>James South</owners> <owners>James South</owners>

7
src/ImageProcessor.Tests/RegularExpressionUnitTests.cs

@ -79,14 +79,13 @@ namespace ImageProcessor.Tests
[TestMethod] [TestMethod]
public void TestCropRegex() public void TestCropRegex()
{ {
const string Querystring = "crop=0-0-150-300"; const string Querystring = "crop=0,0,150,300";
Rectangle expected = new Rectangle(0, 0, 150, 300); CropLayer expected = new CropLayer(0, 0, 150, 300, CropMode.Pixels);
Crop crop = new Crop(); Crop crop = new Crop();
crop.MatchRegexIndex(Querystring); crop.MatchRegexIndex(Querystring);
Rectangle actual = crop.DynamicParameter; CropLayer actual = crop.DynamicParameter;
Assert.AreEqual(expected, actual); Assert.AreEqual(expected, actual);
} }

16
src/ImageProcessor.Web/NET45/HttpModules/ImageProcessingModule.cs

@ -12,6 +12,7 @@ namespace ImageProcessor.Web.HttpModules
{ {
#region Using #region Using
using System; using System;
using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
@ -31,9 +32,6 @@ namespace ImageProcessor.Web.HttpModules
using ImageProcessor.Web.Caching; using ImageProcessor.Web.Caching;
using ImageProcessor.Web.Config; using ImageProcessor.Web.Config;
using ImageProcessor.Web.Helpers; using ImageProcessor.Web.Helpers;
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
#endregion #endregion
/// <summary> /// <summary>
@ -60,7 +58,7 @@ namespace ImageProcessor.Web.HttpModules
/// <summary> /// <summary>
/// The collection of SemaphoreSlims for identifying given locking individual queries. /// The collection of SemaphoreSlims for identifying given locking individual queries.
/// </summary> /// </summary>
private static readonly Dictionary<string, SemaphoreSlim> SemaphoreSlims = new Dictionary<string, SemaphoreSlim>(); private static readonly ConcurrentDictionary<string, SemaphoreSlim> SemaphoreSlims = new ConcurrentDictionary<string, SemaphoreSlim>();
/// <summary> /// <summary>
/// The value to prefix any remote image requests with to ensure they get captured. /// The value to prefix any remote image requests with to ensure they get captured.
@ -153,14 +151,7 @@ namespace ImageProcessor.Web.HttpModules
private static SemaphoreSlim GetSemaphoreSlim(string id) private static SemaphoreSlim GetSemaphoreSlim(string id)
{ {
id = id.ToMD5Fingerprint(); id = id.ToMD5Fingerprint();
SemaphoreSlim semaphore = SemaphoreSlims.GetOrAdd(id, new SemaphoreSlim(1, 1));
if (SemaphoreSlims.ContainsKey(id))
{
return SemaphoreSlims[id];
}
SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
SemaphoreSlims.Add(id, semaphore);
return semaphore; return semaphore;
} }
@ -180,7 +171,6 @@ namespace ImageProcessor.Web.HttpModules
// Dispose of any managed resources here. // Dispose of any managed resources here.
foreach (KeyValuePair<string, SemaphoreSlim> semaphore in SemaphoreSlims) foreach (KeyValuePair<string, SemaphoreSlim> semaphore in SemaphoreSlims)
{ {
semaphore.Value.Wait();
semaphore.Value.Dispose(); semaphore.Value.Dispose();
} }

4
src/ImageProcessor.Web/NET45/Properties/AssemblyInfo.cs

@ -35,5 +35,5 @@ using ImageProcessor.Web.HttpModules;
// //
// 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("3.2.2.0")] [assembly: AssemblyVersion("3.2.3.0")]
[assembly: AssemblyFileVersion("3.2.2.0")] [assembly: AssemblyFileVersion("3.2.3.0")]

1
src/ImageProcessor/Extensions/ImageExtensions.cs

@ -42,6 +42,7 @@ namespace ImageProcessor.Extensions
{ {
Height = image.Height, Height = image.Height,
Width = image.Width, Width = image.Width,
// ReSharper disable once BitwiseOperatorOnEnumWithoutFlags
IsIndexed = (image.PixelFormat & PixelFormat.Indexed) != 0 IsIndexed = (image.PixelFormat & PixelFormat.Indexed) != 0
}; };

42
src/ImageProcessor/Imaging/CropLayer.cs

@ -77,5 +77,47 @@ namespace ImageProcessor.Imaging
/// Gets or sets the <see cref="CropMode"/>. /// Gets or sets the <see cref="CropMode"/>.
/// </summary> /// </summary>
public CropMode CropMode { get; set; } public CropMode CropMode { get; set; }
/// <summary>
/// Determines whether the specified <see cref="System.Object" />, is
/// equal to this instance.
/// </summary>
/// <param name="obj">
/// The <see cref="System.Object" /> to compare with this instance.
/// </param>
/// <returns>
/// <c>true</c> if the specified <see cref="System.Object" /> is equal to
/// this instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object obj)
{
CropLayer cropLayer = obj as CropLayer;
if (cropLayer == null)
{
return false;
}
// Define the tolerance for variation in their values
return Math.Abs(this.Top - cropLayer.Top) <= Math.Abs(this.Top * .0001)
&& Math.Abs(this.Right - cropLayer.Right) <= Math.Abs(this.Right * .0001)
&& Math.Abs(this.Bottom - cropLayer.Bottom) <= Math.Abs(this.Bottom * .0001)
&& Math.Abs(this.Left - cropLayer.Left) <= Math.Abs(this.Left * .0001)
&& this.CropMode.Equals(cropLayer.CropMode);
}
/// <summary>
/// Returns a hash code for this instance.
/// </summary>
/// <returns>
/// A hash code for this instance, suitable for use in hashing algorithms
/// and data structures like a hash table.
/// </returns>
public override int GetHashCode()
{
return this.Top.GetHashCode() + this.Right.GetHashCode() +
this.Bottom.GetHashCode() + this.Left.GetHashCode() +
this.CropMode.GetHashCode();
}
} }
} }

9
src/ImageProcessor/Imaging/RoundedCornerLayer.cs

@ -1,11 +1,4 @@
// ----------------------------------------------------------------------- namespace ImageProcessor.Imaging
// <copyright file="RoundedCornerLayer.cs" company="James South">
// Copyright (c) James South.
// Licensed under the Apache License, Version 2.0.
// </copyright>
// -----------------------------------------------------------------------
namespace ImageProcessor.Imaging
{ {
#region Using #region Using
using System.Drawing; using System.Drawing;

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.8.0")] [assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.8.8.0")] [assembly: AssemblyFileVersion("1.9.0.0")]

9
src/ImageProcessorConsole/Program.cs

@ -1,17 +1,12 @@
using System; 
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ImageProcessorConsole namespace ImageProcessorConsole
{ {
using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using ImageProcessor; using ImageProcessor;
using ImageProcessor.Imaging.Filters;
class Program class Program
{ {

16
src/Web.Test/LoadTest1.loadtest

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LoadTest Name="LoadTest1" Description="" Owner="" storage="c:\users\james south\documents\github\imageprocessor\src\web.test\loadtest1.loadtest" Priority="2147483647" Enabled="true" CssProjectStructure="" CssIteration="" DeploymentItemsEditable="" WorkItemIds="" TraceLevel="None" CurrentRunConfig="Run Settings1" Id="bd358b6a-19c7-4fa0-ad90-9664f5b85e79" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> <LoadTest Name="LoadTest1" Description="" Owner="" storage="c:\users\james\documents\github\imageprocessor\src\web.test\loadtest1.loadtest" Priority="2147483647" Enabled="true" CssProjectStructure="" CssIteration="" DeploymentItemsEditable="" WorkItemIds="" TraceLevel="None" CurrentRunConfig="Run Settings1" Id="bd358b6a-19c7-4fa0-ad90-9664f5b85e79" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Scenarios> <Scenarios>
<Scenario Name="Scenario basic stress" DelayBetweenIterations="0" PercentNewUsers="0" IPSwitching="true" TestMixType="PercentageOfTestsStarted" ApplyDistributionToPacingDelay="true" MaxTestIterations="0" DisableDuringWarmup="false" DelayStartTime="0" AllowedAgents=""> <Scenario Name="Scenario basic stress" DelayBetweenIterations="0" PercentNewUsers="0" IPSwitching="true" TestMixType="PercentageOfTestsStarted" ApplyDistributionToPacingDelay="true" MaxTestIterations="0" DisableDuringWarmup="false" DelayStartTime="0" AllowedAgents="">
<ThinkProfile Value="0.2" Pattern="NormalDistribution" /> <ThinkProfile Value="0.2" Pattern="NormalDistribution" />
<LoadProfile Pattern="Constant" InitialUsers="100" /> <LoadProfile Pattern="Constant" InitialUsers="100" />
<TestMix> <TestMix>
<TestProfile Name="WebTest1" Path="webtest1.webtest" Id="2573f2eb-56b5-4552-8818-12748986ff45" Percentage="100" Type="Microsoft.VisualStudio.TestTools.WebStress.DeclarativeWebTestElement, Microsoft.VisualStudio.QualityTools.LoadTest, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <TestProfile Name="WebTest1" Path="webtest1.webtest" Id="2573f2eb-56b5-4552-8818-12748986ff45" Percentage="100" Type="Microsoft.VisualStudio.TestTools.WebStress.DeclarativeWebTestElement, Microsoft.VisualStudio.QualityTools.LoadTest, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</TestMix> </TestMix>
<BrowserMix> <BrowserMix>
<BrowserProfile Percentage="100"> <BrowserProfile Percentage="100">
<Browser Name="Internet Explorer 9.0" MaxConnections="6"> <Browser Name="Internet Explorer 10.0" MaxConnections="6">
<Headers> <Headers>
<Header Name="User-Agent" Value="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" /> <Header Name="User-Agent" Value="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)" />
<Header Name="Accept" Value="*/*" /> <Header Name="Accept" Value="*/*" />
<Header Name="Accept-Language" Value="{{$IEAcceptLanguage}}" /> <Header Name="Accept-Language" Value="{{$IEAcceptLanguage}}" />
<Header Name="Accept-Encoding" Value="GZIP" /> <Header Name="Accept-Encoding" Value="GZIP" />
@ -92,7 +92,7 @@
<Counter Name="Avg. Response Time" /> <Counter Name="Avg. Response Time" />
<Counter Name="Avg. Connection Wait Time"> <Counter Name="Avg. Connection Wait Time">
<ThresholdRules> <ThresholdRules>
<ThresholdRule Classname="Microsoft.VisualStudio.TestTools.WebStress.Rules.ThresholdRuleCompareCounters, Microsoft.VisualStudio.QualityTools.LoadTest, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <ThresholdRule Classname="Microsoft.VisualStudio.TestTools.WebStress.Rules.ThresholdRuleCompareCounters, Microsoft.VisualStudio.QualityTools.LoadTest, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<RuleParameters> <RuleParameters>
<RuleParameter Name="DependentCategory" Value="LoadTest:Page" /> <RuleParameter Name="DependentCategory" Value="LoadTest:Page" />
<RuleParameter Name="DependentCounter" Value="Avg. Page Time" /> <RuleParameter Name="DependentCounter" Value="Avg. Page Time" />
@ -157,7 +157,7 @@
<Counter Name="Current Bandwidth" RangeGroup="Network Bytes" /> <Counter Name="Current Bandwidth" RangeGroup="Network Bytes" />
<Counter Name="Bytes Total/sec" RangeGroup="Network Bytes"> <Counter Name="Bytes Total/sec" RangeGroup="Network Bytes">
<ThresholdRules> <ThresholdRules>
<ThresholdRule Classname="Microsoft.VisualStudio.TestTools.WebStress.Rules.ThresholdRuleCompareCounters, Microsoft.VisualStudio.QualityTools.LoadTest, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <ThresholdRule Classname="Microsoft.VisualStudio.TestTools.WebStress.Rules.ThresholdRuleCompareCounters, Microsoft.VisualStudio.QualityTools.LoadTest, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<RuleParameters> <RuleParameters>
<RuleParameter Name="DependentCategory" Value="Network Interface" /> <RuleParameter Name="DependentCategory" Value="Network Interface" />
<RuleParameter Name="DependentCounter" Value="Current Bandwidth" /> <RuleParameter Name="DependentCounter" Value="Current Bandwidth" />
@ -303,7 +303,7 @@
<Counter Name="Current Bandwidth" RangeGroup="Network Bytes" /> <Counter Name="Current Bandwidth" RangeGroup="Network Bytes" />
<Counter Name="Bytes Total/sec" RangeGroup="Network Bytes"> <Counter Name="Bytes Total/sec" RangeGroup="Network Bytes">
<ThresholdRules> <ThresholdRules>
<ThresholdRule Classname="Microsoft.VisualStudio.TestTools.WebStress.Rules.ThresholdRuleCompareCounters, Microsoft.VisualStudio.QualityTools.LoadTest, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <ThresholdRule Classname="Microsoft.VisualStudio.TestTools.WebStress.Rules.ThresholdRuleCompareCounters, Microsoft.VisualStudio.QualityTools.LoadTest, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<RuleParameters> <RuleParameters>
<RuleParameter Name="DependentCategory" Value="Network Interface" /> <RuleParameter Name="DependentCategory" Value="Network Interface" />
<RuleParameter Name="DependentCounter" Value="Current Bandwidth" /> <RuleParameter Name="DependentCounter" Value="Current Bandwidth" />
@ -416,7 +416,7 @@
</CounterSet> </CounterSet>
</CounterSets> </CounterSets>
<RunConfigurations> <RunConfigurations>
<RunConfiguration Name="Run Settings1" Description="" ResultsStoreType="Database" TimingDetailsStorage="AllIndividualDetails" SaveTestLogsOnError="true" SaveTestLogsFrequency="0" MaxErrorDetails="200" MaxErrorsPerType="1000" MaxThresholdViolations="1000" MaxRequestUrlsReported="1000" UseTestIterations="false" RunDuration="600" WarmupTime="0" CoolDownTime="0" TestIterations="100" WebTestConnectionModel="ConnectionPerUser" WebTestConnectionPoolSize="50" SampleRate="5" ValidationLevel="High" SqlTracingConnectString="" SqlTracingConnectStringDisplayValue="" SqlTracingDirectory="" SqlTracingEnabled="false" SqlTracingFileCount="2" SqlTracingRolloverEnabled="true" SqlTracingMinimumDuration="500" RunUnitTestsInAppDomain="true" RigType="Small"> <RunConfiguration Name="Run Settings1" Description="" ResultsStoreType="Database" TimingDetailsStorage="AllIndividualDetails" SaveTestLogsOnError="true" SaveTestLogsFrequency="0" MaxErrorDetails="200" MaxErrorsPerType="1000" MaxThresholdViolations="1000" MaxRequestUrlsReported="1000" UseTestIterations="false" RunDuration="600" WarmupTime="0" CoolDownTime="0" TestIterations="100" WebTestConnectionModel="ConnectionPerUser" WebTestConnectionPoolSize="50" SampleRate="5" ValidationLevel="High" SqlTracingConnectString="" SqlTracingConnectStringDisplayValue="" SqlTracingDirectory="" SqlTracingEnabled="false" SqlTracingFileCount="2" SqlTracingRolloverEnabled="true" SqlTracingMinimumDuration="500" RunUnitTestsInAppDomain="true" CoreCount="0">
<CounterSetMappings> <CounterSetMappings>
<CounterSetMapping ComputerName="[CONTROLLER MACHINE]"> <CounterSetMapping ComputerName="[CONTROLLER MACHINE]">
<CounterSetReferences> <CounterSetReferences>

Loading…
Cancel
Save