diff --git a/.gitignore b/.gitignore
index a190a85ba..a63e5ded8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ Tests/**/*.suo
Source/TestResults/
Source/.vs
/Source/Svg.sln.DotSettings.user
+/Source/Svg.XML
diff --git a/Source/DataTypes/SvgUnitConverter.cs b/Source/DataTypes/SvgUnitConverter.cs
index a383cf5a4..6e3b600f4 100644
--- a/Source/DataTypes/SvgUnitConverter.cs
+++ b/Source/DataTypes/SvgUnitConverter.cs
@@ -1,11 +1,6 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.Diagnostics;
using System.Globalization;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Web.UI.WebControls;
namespace Svg
{
diff --git a/Source/Document Structure/SvgGroup.cs b/Source/Document Structure/SvgGroup.cs
index 32e72bd95..20a9927ff 100644
--- a/Source/Document Structure/SvgGroup.cs
+++ b/Source/Document Structure/SvgGroup.cs
@@ -56,7 +56,7 @@ protected override void Render(ISvgRenderer renderer)
}
///
- /// Gets the for this element.
+ /// Gets the for this element.
///
///
public override GraphicsPath Path(ISvgRenderer renderer)
diff --git a/Source/Painting/EnumConverters.cs b/Source/Painting/EnumConverters.cs
index ebb6e55cb..87a8f34d6 100644
--- a/Source/Painting/EnumConverters.cs
+++ b/Source/Painting/EnumConverters.cs
@@ -84,7 +84,7 @@ public EnumBaseConverter() { }
/// Creates a new instance.
/// Specified the default value of the enum.
- /// Specified the case.
+ /// Defines if the value shall be converted to lower camel case or lower case
public EnumBaseConverter(T defaultValue, CaseHandling caseHandling = CaseHandling.CamelCase)
{
this.DefaultValue = defaultValue;
diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs
index a80d3998a..315266f61 100644
--- a/Source/Properties/AssemblyInfo.cs
+++ b/Source/Properties/AssemblyInfo.cs
@@ -1,4 +1,5 @@
using System;
+#if NETFULL
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -34,7 +35,7 @@
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.4.3.*")]
//[assembly: AssemblyFileVersion("1.0.1.*")]
-
+#endif
[assembly: CLSCompliant(true)]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Svg.UnitTests,PublicKey=" +
diff --git a/Source/Svg.csproj b/Source/Svg.csproj
index 8a18cf869..f93b1a6b9 100644
--- a/Source/Svg.csproj
+++ b/Source/Svg.csproj
@@ -1,393 +1,145 @@
-
-
+
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {886A98C5-37C0-4E8B-885E-30C1D2F98B47}
- Library
- Properties
+ net40;netcoreapp2.2;net35;net452;net472
+ MIT
Svg
Svg
- OnOutputUpdated
-
-
- 3.5
-
-
- v3.5
- false
-
-
-
-
-
-
-
-
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- true
-
- False
- False
- False
- False
- False
- File
- obj\$(Configuration)\
-
-
- Full
- false
- ..\..\vvvv\public\common\src\thirdparty\
- TRACE;DEBUG;REFLECTION
- prompt
- 4
- AllRules.ruleset
- true
-
-
- false
- 1591
-
-
- PdbOnly
- True
- bin\Release\
- TRACE
- prompt
- 4
-
-
- AllRules.ruleset
- false
- bin\Release\Svg.XML
+ true
+
+ davescriven,jvenema,owaits,ddpruitt,Ralf1108,Tebjan Halm,and others
+ Svg
+ SVG Rendering Library
+ SVG Rendering Library
+
+ Public fork of the C# SVG rendering library on codeplex: https://svg.codeplex.com/
+ This started out as a minor modification to enable the writing of proper SVG strings. But now after almost two years we have so many fixes and improvements that we decided to share our current codebase to the public in order to improve it even further.
+ So please feel free to fork it and open pull requests for any fix, improvement or feature you add.
+ License: Microsoft Public License: https://svg.codeplex.com/license
+
+ Copyright © vvvv.org
+ svg, vector graphics, rendering
+ {886A98C5-37C0-4E8B-885E-30C1D2F98B47}
+ $(OutputPath)Svg.XML
+ Debug;Release
1591
-
-
true
-
-
svgkey.snk
+ 2.4.5.0
+ 2.4.5.0
+ 2.4.5
+ svg, vector graphics, rendering
+ true
+ false
+ true
+
+Supports multiple targets v3.5 thru to dotnetcore2.2.
+NetStandard does not fully support the Drawing2D package - so has been left out.
+
+ https://github.com/vvvv/SVG
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 2.0 %28x86%29
- true
-
-
- False
- .NET Framework 3.0 %28x86%29
- false
-
-
- False
- .NET Framework 3.5
- false
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
+
-
-
-
-
-
-
-
+
+
+ $(DefineConstants);TRACE;DEBUG
+
+
+ $(DefineConstants);TRACE;RELEASE
+
+
+
+ Svg for .Net Framework 3.5
+ $(DefineConstants);NETFULL;NET35
+ true
+
+
+
+ Svg for .Net Framework 4.0
+ $(DefineConstants);NETFULL;NET40
+ true
+
+
+
+ Svg for .Net Framework 4.5.2
+ $(DefineConstants);NETFULL;NET452
+ true
+
+
+
+ Svg for .Net Framework 4.7.2
+ $(DefineConstants);NETFULL;NET472
+ true
+
+
+
+ Svg for .Net Core 2.2
+ $(DefineConstants);NETCORE;NETCORE22
+
+
+
+
+
+
+
+
+
+
-
-
+ $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client
-
- False
- Auto
- 4194304
- AnyCPU
- 4096
+
+ $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
-
- False
+
+ $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2
-
- False
- obj\
+
+ $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 4.5.1
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/Svg.sln b/Source/Svg.sln
index 5348237dd..248b73438 100644
--- a/Source/Svg.sln
+++ b/Source/Svg.sln
@@ -1,13 +1,11 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25123.0
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.168
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Svg", "Svg.csproj", "{886A98C5-37C0-4E8B-885E-30C1D2F98B47}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Svg", "Svg.csproj", "{886A98C5-37C0-4E8B-885E-30C1D2F98B47}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SVGViewer", "..\Samples\SVGViewer\SVGViewer.csproj", "{1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Svg.UnitTests", "..\Tests\Svg.UnitTests\Svg.UnitTests.csproj", "{E702EB7D-D01D-438A-BADD-E72D4E49109F}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Svg.UnitTests", "..\Tests\Svg.UnitTests\Svg.UnitTests.csproj", "{E702EB7D-D01D-438A-BADD-E72D4E49109F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A417AF1E-BEDB-4715-B4FD-D795579217F9}"
ProjectSection(SolutionItems) = preProject
@@ -16,10 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SvgW3CTestRunner", "..\Tests\SvgW3CTestRunner\SvgW3CTestRunner.csproj", "{8ED74C39-6CFF-421E-952A-30F9E6957108}"
-EndProject
-Project("{FF286327-C783-4F7A-AB73-9BCBAD0D4460}") = "Svg.Package", "SvgNuget\Svg.Package.nuproj", "{AEEFC0CC-6D17-439D-B8E0-53B713485E3B}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -40,18 +34,6 @@ Global
{886A98C5-37C0-4E8B-885E-30C1D2F98B47}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{886A98C5-37C0-4E8B-885E-30C1D2F98B47}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{886A98C5-37C0-4E8B-885E-30C1D2F98B47}.Release|x86.ActiveCfg = Release|Any CPU
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Any CPU.ActiveCfg = Release|Any CPU
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Any CPU.Build.0 = Release|Any CPU
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|x86.ActiveCfg = Debug|x86
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|x86.Build.0 = Debug|Any CPU
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|Any CPU.Build.0 = Release|Any CPU
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|Mixed Platforms.Build.0 = Release|x86
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|x86.ActiveCfg = Release|Any CPU
- {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|x86.Build.0 = Release|Any CPU
{E702EB7D-D01D-438A-BADD-E72D4E49109F}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{E702EB7D-D01D-438A-BADD-E72D4E49109F}.Debug|Any CPU.Build.0 = Release|Any CPU
{E702EB7D-D01D-438A-BADD-E72D4E49109F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -62,34 +44,13 @@ Global
{E702EB7D-D01D-438A-BADD-E72D4E49109F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E702EB7D-D01D-438A-BADD-E72D4E49109F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E702EB7D-D01D-438A-BADD-E72D4E49109F}.Release|x86.ActiveCfg = Release|Any CPU
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|Any CPU.ActiveCfg = Release|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|Any CPU.Build.0 = Release|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|x86.ActiveCfg = Debug|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|x86.Build.0 = Debug|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|Any CPU.ActiveCfg = Release|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|Any CPU.Build.0 = Release|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|Mixed Platforms.Build.0 = Release|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|x86.ActiveCfg = Release|x86
- {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|x86.Build.0 = Release|x86
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|x86.ActiveCfg = Debug|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|x86.Build.0 = Debug|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|Any CPU.Build.0 = Release|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|x86.ActiveCfg = Release|Any CPU
- {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {5096EEB3-8F41-44B5-BCF9-58743A59AB21}
+ EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = Svg.vsmdi
EndGlobalSection
diff --git a/Source/SvgDocument.cs b/Source/SvgDocument.cs
index fc4c46db7..b563cdde0 100644
--- a/Source/SvgDocument.cs
+++ b/Source/SvgDocument.cs
@@ -230,9 +230,10 @@ public static SvgDocument Open(string path)
using (var strReader = new System.IO.StringReader(svg))
{
- var reader = new SvgTextReader(strReader, null);
- reader.XmlResolver = new SvgDtdResolver();
- reader.WhitespaceHandling = WhitespaceHandling.None;
+ var reader = new SvgTextReader(strReader, null)
+ {
+ XmlResolver = new SvgDtdResolver(), WhitespaceHandling = WhitespaceHandling.None
+ };
return Open(reader);
}
}
@@ -251,9 +252,10 @@ public static SvgDocument Open(string path)
}
// Don't close the stream via a dispose: that is the client's job.
- var reader = new SvgTextReader(stream, entities);
- reader.XmlResolver = new SvgDtdResolver();
- reader.WhitespaceHandling = WhitespaceHandling.None;
+ var reader = new SvgTextReader(stream, entities)
+ {
+ XmlResolver = new SvgDtdResolver(), WhitespaceHandling = WhitespaceHandling.None
+ };
return Open(reader);
}
@@ -621,8 +623,10 @@ public override void Write(XmlTextWriter writer)
public void Write(Stream stream, bool useBom = true)
{
- var xmlWriter = new XmlTextWriter(stream, useBom ? Encoding.UTF8 : new System.Text.UTF8Encoding(false));
- xmlWriter.Formatting = Formatting.Indented;
+ var xmlWriter = new XmlTextWriter(stream, useBom ? Encoding.UTF8 : new System.Text.UTF8Encoding(false))
+ {
+ Formatting = Formatting.Indented
+ };
xmlWriter.WriteStartDocument();
xmlWriter.WriteDocType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", null);
diff --git a/Source/SvgElement.cs b/Source/SvgElement.cs
index 1220ebfd2..414001037 100644
--- a/Source/SvgElement.cs
+++ b/Source/SvgElement.cs
@@ -652,7 +652,13 @@ private Dictionary WritePropertyAttributes(XmlTextWriter writer)
}
}
+#if NETFULL
var value = (string)attr.Property.Converter.ConvertTo(propertyValue, typeof(string));
+#else
+ // dotnetcore throws exception if input is null
+ string value = propertyValue==null?null:(string)attr.Property.Converter.ConvertTo(propertyValue, typeof(string));
+#endif
+
if (propertyValue != null)
{
var type = propertyValue.GetType();
diff --git a/Source/Web/SvgHandler.cs b/Source/Web/SvgHandler.cs
index 832e511aa..e172baded 100644
--- a/Source/Web/SvgHandler.cs
+++ b/Source/Web/SvgHandler.cs
@@ -1,3 +1,4 @@
+#if NETFULL
using System;
using System.Collections;
using System.Collections.Generic;
@@ -230,4 +231,5 @@ public WaitHandle AsyncWaitHandle
}
}
}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file
diff --git a/Tests/Svg.UnitTests/ImageComparisonTest.cs b/Tests/Svg.UnitTests/ImageComparisonTest.cs
index af6c36c71..2debf703d 100644
--- a/Tests/Svg.UnitTests/ImageComparisonTest.cs
+++ b/Tests/Svg.UnitTests/ImageComparisonTest.cs
@@ -1,9 +1,11 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
+using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
+using System.Linq;
namespace Svg.UnitTests
{
@@ -13,6 +15,32 @@ namespace Svg.UnitTests
public class ImageComparisonTest
{
public TestContext TestContext { get; set; }
+#if NETCORE
+ private static string _basePath = null;
+ private static string GetSuiteTestsFolder
+ {
+ get
+ {
+ if (_basePath != null) return _basePath;
+ var basePath = Environment.CurrentDirectory;
+ while (!basePath.ToLower().EndsWith("svg"))
+ {
+ basePath = Path.GetDirectoryName(basePath);
+ }
+
+ _basePath = Path.Combine(basePath, "Tests");
+ return _basePath;
+ }
+ }
+
+ private static IEnumerable