Migrate to supported .NET Core versions (#787)

* Migrate to supported .NET Core versions:
        - from .NET Core 2.2 (Out of support version) to .NET Core 2.1
        - from .NET Core 3.0 (Out of support version) to .NET Core 3.1
* Add support for .NET 5.0 as the currently recommended .NET SDK

* Added ToSvgString extension method for float
* Added ToStringBenchmarks
* Add netcoreapp3.1 target for test runner
* Add smaller image to reproduce #789
This commit is contained in:
Wiesław Šoltés 2021-01-12 18:36:33 +01:00 коммит произвёл GitHub
Родитель f78cffe9d9
Коммит 58424ccebe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
41 изменённых файлов: 370 добавлений и 116 удалений

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net461;netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net461;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>net461;net5.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>

Просмотреть файл

@ -10,24 +10,24 @@ Install latest [.NET Core SDK](https://dotnet.microsoft.com/download).
```
cd Samples/SvgConsole
dotnet publish -f netcoreapp2.2 -c Release -r win-x64 -o SvgConsole-win-x64-netcoreapp2.2
cd SvgConsole-win-x64-netcoreapp2.2
dotnet publish -f netcoreapp3.1 -c Release -r win-x64 -o SvgConsole-win-x64-netcoreapp3.1
cd SvgConsole-win-x64-netcoreapp3.1
```
### Linux
```
cd Samples/SvgConsole
dotnet publish -f netcoreapp2.2 -c Release -r linux-x64 -o SvgConsole-linux-x64-netcoreapp2.2
cd SvgConsole-linux-x64-netcoreapp2.2
dotnet publish -f netcoreapp3.1 -c Release -r linux-x64 -o SvgConsole-linux-x64-netcoreapp3.1
cd SvgConsole-linux-x64-netcoreapp3.1
```
### macOS
```
cd Samples/SvgConsole
dotnet publish -f netcoreapp2.2 -c Release -r osx-x64 -o SvgConsole-osx-x64-netcoreapp2.2
cd SvgConsole-osx-x64-netcoreapp2.2
dotnet publish -f netcoreapp3.1 -c Release -r osx-x64 -o SvgConsole-osx-x64-netcoreapp3.1
cd SvgConsole-osx-x64-netcoreapp3.1
```
### Other

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>False</IsPackable>
<IsTool>True</IsTool>
<PackAsTool>True</PackAsTool>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net461;netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net461;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>net461;net5.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>

Просмотреть файл

@ -23,7 +23,7 @@ namespace Svg
public override string ToString()
{
return string.Join(" ", this.Select(v => v.ToString(CultureInfo.InvariantCulture)).ToArray());
return string.Join(" ", this.Select(v => v.ToSvgString()).ToArray());
}
}

Просмотреть файл

@ -92,7 +92,7 @@ namespace Svg
if (IsAuto)
return IsAutoStartReverse ? "auto-start-reverse" : "auto";
else
return Angle.ToString(CultureInfo.InvariantCulture);
return Angle.ToSvgString();
}
/// <summary>

Просмотреть файл

@ -32,9 +32,9 @@ namespace Svg
builder.Append(" ");
}
// we don't need unit type
builder.Append(this[i].Value.ToString(CultureInfo.InvariantCulture));
builder.Append(this[i].Value.ToSvgString());
builder.Append(",");
builder.Append(this[i + 1].Value.ToString(CultureInfo.InvariantCulture));
builder.Append(this[i + 1].Value.ToSvgString());
}
}
return builder.ToString();

Просмотреть файл

@ -167,8 +167,8 @@ namespace Svg
_deviceValue = (size.Height / 100) * value + boundable.Location.Y;
break;
case UnitRenderingType.Other:
// Calculate a percentage value of the normalized viewBox diagonal length.
if (owner.OwnerDocument != null && owner.OwnerDocument.ViewBox != null && owner.OwnerDocument.ViewBox.Width != 0 && owner.OwnerDocument.ViewBox.Height != 0)
// Calculate a percentage value of the normalized viewBox diagonal length.
if (owner.OwnerDocument != null && owner.OwnerDocument.ViewBox.Width != 0 && owner.OwnerDocument.ViewBox.Height != 0)
{
_deviceValue = (float)(Math.Sqrt(Math.Pow(owner.OwnerDocument.ViewBox.Width, 2) + Math.Pow(owner.OwnerDocument.ViewBox.Height, 2)) / Math.Sqrt(2) * value / 100.0);
}
@ -180,7 +180,8 @@ namespace Svg
_deviceValue = value;
break;
}
return this._deviceValue.Value;
return this._deviceValue.HasValue ? this._deviceValue.Value : 0f;
}
private IFontDefn GetFont(ISvgRenderer renderer, SvgElement owner, SvgFontManager fontManager)
@ -276,7 +277,7 @@ namespace Svg
break;
}
return string.Concat(this.Value.ToString(CultureInfo.InvariantCulture), type);
return string.Concat(this.Value.ToSvgString(), type);
}
/// <summary>

Просмотреть файл

@ -242,8 +242,8 @@ namespace Svg
var viewBox = (SvgViewBox)value;
return string.Format("{0}, {1}, {2}, {3}",
viewBox.MinX.ToString(CultureInfo.InvariantCulture), viewBox.MinY.ToString(CultureInfo.InvariantCulture),
viewBox.Width.ToString(CultureInfo.InvariantCulture), viewBox.Height.ToString(CultureInfo.InvariantCulture));
viewBox.MinX.ToString(CultureInfo.InvariantCulture), viewBox.MinY.ToSvgString(),
viewBox.Width.ToString(CultureInfo.InvariantCulture), viewBox.Height.ToSvgString());
}
return base.ConvertTo(context, culture, value, destinationType);

Просмотреть файл

@ -161,15 +161,15 @@ namespace Svg
var firstChildren = chain.Where(p => p.Children.Count > 0).FirstOrDefault();
if (firstChildren == null)
return null;
var firstX = chain.Where(p => p.X != null && p.X != SvgUnit.None).FirstOrDefault();
var firstY = chain.Where(p => p.Y != null && p.Y != SvgUnit.None).FirstOrDefault();
var firstWidth = chain.Where(p => p.Width != null && p.Width != SvgUnit.None).FirstOrDefault();
var firstHeight = chain.Where(p => p.Height != null && p.Height != SvgUnit.None).FirstOrDefault();
var firstX = chain.Where(p => p.X != SvgUnit.None).FirstOrDefault();
var firstY = chain.Where(p => p.Y != SvgUnit.None).FirstOrDefault();
var firstWidth = chain.Where(p => p.Width != SvgUnit.None).FirstOrDefault();
var firstHeight = chain.Where(p => p.Height != SvgUnit.None).FirstOrDefault();
if (firstWidth == null || firstHeight == null)
return null;
var firstPatternUnit = chain.Where(p => p._patternUnits.HasValue).FirstOrDefault();
var firstPatternContentUnit = chain.Where(p => p._patternContentUnits.HasValue).FirstOrDefault();
var firstViewBox = chain.Where(p => p.ViewBox != null && p.ViewBox != SvgViewBox.Empty).FirstOrDefault();
var firstViewBox = chain.Where(p => p.ViewBox != SvgViewBox.Empty).FirstOrDefault();
var xUnit = firstX == null ? new SvgUnit(0f) : firstX.X;
var yUnit = firstY == null ? new SvgUnit(0f) : firstY.Y;

Просмотреть файл

@ -288,7 +288,7 @@ namespace Svg
if (state.CurrNumState != NumState.Separator && state.NewNumState < state.CurrNumState)
{
#if NETSTANDARD2_1 || NETCORE || NETCOREAPP2_2 || NETCOREAPP3_0
#if NETSTANDARD2_1 || NETCORE || NETCOREAPP2_1 || NETCOREAPP3_1 || NET5_0
result = float.Parse(chars.Slice(state.Position, state.CharsPosition - state.Position), NumberStyles.Float, CultureInfo.InvariantCulture);
#else
result = float.Parse(chars.Slice(state.Position, state.CharsPosition - state.Position).ToString(), NumberStyles.Float, CultureInfo.InvariantCulture);
@ -318,7 +318,7 @@ namespace Svg
}
else
{
#if NETSTANDARD2_1 || NETCORE || NETCOREAPP2_2 || NETCOREAPP3_0
#if NETSTANDARD2_1 || NETCORE || NETCOREAPP2_1 || NETCOREAPP3_1 || NET5_0
result = float.Parse(chars.Slice(state.Position, charsLength - state.Position), NumberStyles.Float, CultureInfo.InvariantCulture);
#else
result = float.Parse(chars.Slice(state.Position, charsLength - state.Position).ToString(), NumberStyles.Float, CultureInfo.InvariantCulture);

Просмотреть файл

@ -136,7 +136,7 @@ namespace Svg.Pathing
{
var arcFlag = Size == SvgArcSize.Large ? "1" : "0";
var sweepFlag = Sweep == SvgArcSweep.Positive ? "1" : "0";
return "A" + RadiusX.ToString(CultureInfo.InvariantCulture) + " " + RadiusY.ToString(CultureInfo.InvariantCulture) + " " + Angle.ToString(CultureInfo.InvariantCulture) + " " + arcFlag + " " + sweepFlag + " " + End.ToSvgString();
return "A" + RadiusX.ToSvgString() + " " + RadiusY.ToSvgString() + " " + Angle.ToSvgString() + " " + arcFlag + " " + sweepFlag + " " + End.ToSvgString();
}
}

Просмотреть файл

@ -10,9 +10,15 @@ namespace Svg
{
public static class PointFExtensions
{
public static string ToSvgString(this float value)
{
// Use G7 format specifier to be compatible across all target frameworks.
return value.ToString("G7", CultureInfo.InvariantCulture);
}
public static string ToSvgString(this PointF p)
{
return p.X.ToString(CultureInfo.InvariantCulture) + " " + p.Y.ToString(CultureInfo.InvariantCulture);
return p.X.ToSvgString() + " " + p.Y.ToSvgString();
}
}

Просмотреть файл

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp2.2;netcoreapp3.0;net452;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp2.1;netcoreapp3.1;net5.0;net452;net461</TargetFrameworks>
<PackageLicenseExpression>MS-PL</PackageLicenseExpression>
<RootNamespace>Svg</RootNamespace>
<AssemblyName>Svg</AssemblyName>
@ -28,7 +28,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>Supports multiple targets v4.5.2 thru to dotnetcore3.0.
<PackageReleaseNotes>Supports multiple targets v4.5.2 thru to dotnetcore3.1 and .NET 5.0.
Many performance improvements by using SourceGenerators instad of reflection.
</PackageReleaseNotes>
@ -75,14 +75,19 @@ Many performance improvements by using SourceGenerators instad of reflection.
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp2.2'">
<Title>Svg for .Net Core 2.2</Title>
<DefineConstants>$(DefineConstants);NETCORE;NETCORE22</DefineConstants>
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp2.1'">
<Title>Svg for .Net Core 2.1</Title>
<DefineConstants>$(DefineConstants);NETCORE;NETCORE21</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp3.0'">
<Title>Svg for .Net Core 3.0</Title>
<DefineConstants>$(DefineConstants);NETCORE;NETCORE30</DefineConstants>
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
<Title>Svg for .Net Core 3.1</Title>
<DefineConstants>$(DefineConstants);NETCORE;NETCORE31</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net5.0'">
<Title>Svg for .Net 5.0</Title>
<DefineConstants>$(DefineConstants);NETCORE;NETCORE50</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
@ -108,27 +113,19 @@ Many performance improvements by using SourceGenerators instad of reflection.
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.2' Or '$(TargetFramework)' == 'netcoreapp3.0'">
<PackageReference Include="System.Drawing.Common">
<Version>4.7.0</Version>
</PackageReference>
<PackageReference Include="System.ObjectModel">
<Version>4.3.0</Version>
</PackageReference>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0'">
<PackageReference Include="System.Drawing.Common" Version="5.0.0" />
<PackageReference Include="System.ObjectModel" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Drawing.Common">
<Version>4.7.0</Version>
</PackageReference>
<PackageReference Include="System.ObjectModel">
<Version>4.3.0</Version>
</PackageReference>
<PackageReference Include="System.Drawing.Common" Version="5.0.0" />
<PackageReference Include="System.ObjectModel" Version="4.3.0" />
</ItemGroup>
<!-- Mac specific include -->
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.2' Or '$(TargetFramework)' == 'netcoreapp3.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0'">
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.8.64" />
</ItemGroup>
@ -140,7 +137,7 @@ Many performance improvements by using SourceGenerators instad of reflection.
<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="System.Memory" Version="4.5.3" />
<PackageReference Include="System.Memory" Version="4.5.4" />
<PackageReference Include="Fizzler" Version="1.2.0" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37">
<PrivateAssets>all</PrivateAssets>

Просмотреть файл

@ -704,7 +704,7 @@ namespace Svg
/// <param name="rasterHeight"></param>
public virtual void RasterizeDimensions(ref SizeF size, int rasterWidth, int rasterHeight)
{
if (size == null || size.Width == 0)
if (size.Width == 0)
return;
// Ratio of height/width of the original SVG size, to be used for scaling transformation

Просмотреть файл

@ -28,8 +28,7 @@ namespace Svg.Transforms
public override string WriteToString()
{
return string.Format(CultureInfo.InvariantCulture, "matrix({0}, {1}, {2}, {3}, {4}, {5})",
Points[0], Points[1], Points[2], Points[3], Points[4], Points[5]);
return $"matrix({Points[0].ToSvgString()}, {Points[1].ToSvgString()}, {Points[2].ToSvgString()}, {Points[3].ToSvgString()}, {Points[4].ToSvgString()}, {Points[5].ToSvgString()})";
}
public SvgMatrix(List<float> m)

Просмотреть файл

@ -25,7 +25,7 @@ namespace Svg.Transforms
public override string WriteToString()
{
return string.Format(CultureInfo.InvariantCulture, "rotate({0}, {1}, {2})", Angle, CenterX, CenterY);
return $"rotate({Angle.ToSvgString()}, {CenterX.ToSvgString()}, {CenterY.ToSvgString()})";
}
public SvgRotate(float angle)

Просмотреть файл

@ -22,8 +22,8 @@ namespace Svg.Transforms
public override string WriteToString()
{
if (X == Y)
return string.Format(CultureInfo.InvariantCulture, "scale({0})", X);
return string.Format(CultureInfo.InvariantCulture, "scale({0}, {1})", X, Y);
return $"scale({X.ToSvgString()})";
return $"scale({X.ToSvgString()}, {Y.ToSvgString()})";
}
public SvgScale(float x)

Просмотреть файл

@ -24,7 +24,7 @@ namespace Svg.Transforms
public override string WriteToString()
{
return string.Format(CultureInfo.InvariantCulture, "shear({0}, {1})", X, Y);
return $"shear({X.ToSvgString()}, {Y.ToSvgString()})";
}
public SvgShear(float x)

Просмотреть файл

@ -26,8 +26,8 @@ namespace Svg.Transforms
public override string WriteToString()
{
if (AngleY == 0f)
return string.Format(CultureInfo.InvariantCulture, "skewX({0})", AngleX);
return string.Format(CultureInfo.InvariantCulture, "skewY({0})", AngleY);
return $"skewX({AngleX.ToSvgString()})";
return $"skewY({AngleY.ToSvgString()})";
}
public SvgSkew(float x, float y)

Просмотреть файл

@ -65,7 +65,7 @@ namespace Svg.Transforms
private static float ToFloat(ref ReadOnlySpan<char> value)
{
#if NETSTANDARD2_1 || NETCORE || NETCOREAPP2_2 || NETCOREAPP3_0
#if NETSTANDARD2_1 || NETCORE || NETCOREAPP2_1 || NETCOREAPP3_1 || NET5_0
return float.Parse(value, NumberStyles.Float, CultureInfo.InvariantCulture);
#else
return float.Parse(value.ToString(), NumberStyles.Float, CultureInfo.InvariantCulture);

Просмотреть файл

@ -21,7 +21,7 @@ namespace Svg.Transforms
public override string WriteToString()
{
return string.Format(CultureInfo.InvariantCulture, "translate({0}, {1})", X, Y);
return $"translate({X.ToSvgString()}, {Y.ToSvgString()})";
}
public SvgTranslate(float x, float y)

Просмотреть файл

@ -12,6 +12,12 @@ dotnet run -c Release -f netcoreapp3.1 -- -f '*'
dotnet run -c Release -f netcoreapp3.1 -- -f '*SvgDocument_*'
```
### Run `ToStringBenchmarks` Benchmarks
```
dotnet run -c Release -f netcoreapp3.1 -- -f '*ToStringBenchmarks*'
```
### Run `SvgPathBuilder` Benchmarks
```
@ -29,17 +35,3 @@ dotnet run -c Release -f netcoreapp3.1 -- -f '*CoordinateParser_*'
```
dotnet run -c Release -f netcoreapp3.1 -- -f '*SvgTransformConverter_*'
```
### TODO
- EnumBaseConverter
- SvgPreserveAspectRatioConverter
- SvgNumberCollectionConverter
- SvgOrientConverter
- SvgPointCollectionConverter
- SvgUnitCollectionConverter
- SvgUnitConverter
- SvgViewBoxConverter
- SvgPaintServerFactory
- SvgPathBuilder
- ColorConverter

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.2;netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net461</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
@ -21,11 +21,7 @@
<ProjectReference Include="..\..\Source\Svg.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.2'">
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net452' Or '$(TargetFramework)'=='net461'">
<ItemGroup Condition="'$(TargetFramework)'=='net461'">
<Reference Include="WindowsBase" />
</ItemGroup>

Просмотреть файл

@ -0,0 +1,26 @@
using System.Globalization;
using BenchmarkDotNet.Attributes;
namespace Svg.Benchmarks
{
public class ToStringBenchmarks
{
[Benchmark(Baseline = true)]
public void Float_ToString()
{
123.456f.ToString(CultureInfo.InvariantCulture);
789.01f.ToString(CultureInfo.InvariantCulture);
(-45.01f).ToString(CultureInfo.InvariantCulture);
31.045f.ToString(CultureInfo.InvariantCulture);
}
[Benchmark]
public void Float_ToSvgString()
{
123.456f.ToSvgString();
789.01f.ToSvgString();
(-45.01f).ToSvgString();
31.045f.ToSvgString();
}
}
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace Svg.UnitTests
{
get
{
string codeBase = typeof(PerformanceTest).Assembly.CodeBase;
string codeBase = typeof(PerformanceTest).Assembly.Location;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsTestProject>true</IsTestProject>
<TargetFrameworks>netcoreapp2.2;net452;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net452;net461</TargetFrameworks>
<IsPackable>false</IsPackable>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>svgkey.snk</AssemblyOriginatorKeyFile>
@ -23,11 +23,23 @@
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net461|AnyCPU'">
<DefineConstants>TRACE;RELEASE;NETFULL;NET461</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netcoreapp2.2|AnyCPU'">
<DefineConstants>TRACE;RELEASE;NETCORE</DefineConstants>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netcoreapp2.1|AnyCPU'">
<DefineConstants>TRACE;RELEASE;NETCORE;NETCORE21</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp2.2|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETCORE</DefineConstants>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp2.1|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETCORE;NETCORE21</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netcoreapp3.1|AnyCPU'">
<DefineConstants>TRACE;RELEASE;NETCORE;NETCORE31</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp3.1|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETCORE;NETCORE31</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net5.0|AnyCPU'">
<DefineConstants>TRACE;RELEASE;NETCORE;NETCORE50</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net5.0|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETCORE;NETCORE50</DefineConstants>
</PropertyGroup>
<ItemGroup>
@ -55,9 +67,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="NUnit" Version="3.13.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
@ -65,10 +77,6 @@
<ProjectReference Include="..\..\Source\Svg.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.2'">
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net452' Or '$(TargetFramework)'=='net461'">
<Reference Include="WindowsBase" />
</ItemGroup>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net461;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>

Просмотреть файл

@ -52,12 +52,12 @@ namespace SvgW3CTestRunner
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{ //click event
ContextMenu contextMenu = new System.Windows.Forms.ContextMenu();
MenuItem menuItem = new MenuItem("Copy");
var contextMenu = new System.Windows.Forms.ContextMenuStrip();
var menuItem = new ToolStripMenuItem("Copy");
menuItem.Click += new EventHandler(CopyAction);
contextMenu.MenuItems.Add(menuItem);
contextMenu.Items.Add(menuItem);
boxConsoleLog.ContextMenu = contextMenu;
boxConsoleLog.ContextMenuStrip = contextMenu;
}
}

Двоичные данные
Tests/W3CTestSuite/png/__issue-789-01.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.8 KiB

Двоичные данные
Tests/W3CTestSuite/png/__issue-789-02.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 365 B

Двоичные данные
Tests/W3CTestSuite/png/__issue-789-03.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 348 B

Просмотреть файл

@ -0,0 +1,217 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="959.052"
height="1260.7886"
id="svg5442">
<defs
id="defs5444">
<pattern
patternUnits="userSpaceOnUse"
width="60"
height="60"
patternTransform="translate(219.67282,463.524)"
id="pattern9957">
<g
transform="matrix(1.5,0,0,1.4999975,-401.13423,-731.28467)"
id="white_paper_tile_pattern">
<rect
style="color:#000000;fill:#f4f4f4;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9692"
width="40"
height="40"
x="267.42282"
y="487.52396"
ry="0.39292026" />
<g
id="g9694"
transform="translate(0.12872314,2.7372102)">
<rect
style="color:#000000;fill:#f8f8f8;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9595"
width="40"
height="1.6831467"
x="267.2941"
y="499.78674" />
<rect
y="501.46991"
x="267.2941"
height="1.6831467"
width="40"
id="rect9597"
style="color:#000000;fill:#f4f4f4;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9599"
width="40"
height="1.6336424"
x="267.2941"
y="503.15308" />
<rect
y="494.78674"
x="267.2941"
height="1.6831467"
width="40"
id="rect9601"
style="color:#000000;fill:#f8f8f8;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f4f4f4;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9603"
width="40"
height="1.6831467"
x="267.2941"
y="496.46991" />
<rect
y="498.15308"
x="267.2941"
height="1.6336424"
width="40"
id="rect9605"
style="color:#000000;fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
y="489.78674"
x="267.2941"
height="1.6831467"
width="40"
id="rect9607"
style="color:#000000;fill:#f8f8f8;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f4f4f4;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9609"
width="40"
height="1.6831467"
x="267.2941"
y="491.46991" />
<rect
y="493.15308"
x="267.2941"
height="1.6336424"
width="40"
id="rect9611"
style="color:#000000;fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f8f8f8;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9613"
width="40"
height="1.6831467"
x="267.2941"
y="484.78671" />
<rect
y="486.46988"
x="267.2941"
height="1.6831467"
width="40"
id="rect9615"
style="color:#000000;fill:#f4f4f4;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9617"
width="40"
height="1.6336424"
x="267.2941"
y="488.15305" />
<rect
y="519.7868"
x="267.2941"
height="1.6831467"
width="40"
id="rect9619"
style="color:#000000;fill:#f8f8f8;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f4f4f4;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9621"
width="40"
height="1.6831467"
x="267.2941"
y="521.46997" />
<rect
y="523.15314"
x="267.2941"
height="1.6336424"
width="40"
id="rect9623"
style="color:#000000;fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f8f8f8;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9625"
width="40"
height="1.6831467"
x="267.2941"
y="514.7868" />
<rect
y="516.46997"
x="267.2941"
height="1.6831467"
width="40"
id="rect9627"
style="color:#000000;fill:#f4f4f4;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9629"
width="40"
height="1.6336424"
x="267.2941"
y="518.15314" />
<rect
style="color:#000000;fill:#f8f8f8;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9631"
width="40"
height="1.6831467"
x="267.2941"
y="509.78674" />
<rect
y="511.46991"
x="267.2941"
height="1.6831467"
width="40"
id="rect9633"
style="color:#000000;fill:#f4f4f4;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9635"
width="40"
height="1.6336424"
x="267.2941"
y="513.15308" />
<rect
y="504.78674"
x="267.2941"
height="1.6831467"
width="40"
id="rect9637"
style="color:#000000;fill:#f8f8f8;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="color:#000000;fill:#f4f4f4;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect9639"
width="40"
height="1.6831467"
x="267.2941"
y="506.46991" />
<rect
y="508.15308"
x="267.2941"
height="1.6336424"
width="40"
id="rect9641"
style="color:#000000;fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</g>
</pattern>
</defs>
<rect
width="319.96677"
height="289.28461"
x="638.27045"
y="72.956505"
id="rect10203"
style="color:#000000;fill:url(#pattern9957);fill-opacity:1;stroke:#000000;stroke-width:1.62123179;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</svg>

После

Ширина:  |  Высота:  |  Размер: 9.5 KiB

Просмотреть файл

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="100"
height="100"
>
<rect
width="100"
height="100"
x="0"
y="0"
style="color:#000000;fill:#f0f0f0;fill-opacity:1;stroke:#000000;stroke-width:1.62123179;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</svg>

После

Ширина:  |  Высота:  |  Размер: 593 B

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100" height="100">
<rect width="100" height="100" x="0" y="0" style="fill:#f0f0f0" />
</svg>

После

Ширина:  |  Высота:  |  Размер: 213 B

Просмотреть файл

@ -42,11 +42,11 @@ Once you downloaded the sources you can use the IDE of your choice to open the s
and use your IDE to compile the version you would like to have.
If you would like to use `dotnet-cli` to build the sources you can use the following command in the `Sources/` folder to build the library
for .NET Core 2.2 with the compiler setting for release:
for .NET Core 3.1 with the compiler setting for release:
```
dotnet build -c release -f netcoreapp2.2 Svg.csproj
dotnet build -c release -f netcoreapp3.1 Svg.csproj
```
This will put the output into the `bin/Release/netcoreapp2.2/` folder.
This will put the output into the `bin/Release/netcoreapp3.1/` folder.
## Special instructions for Mac and Linux
The library depends on GDI+ (see also [here](http://svg-net.github.io/SVG/doc/Q&A.html#im-getting-a-svggdipluscannotbeloadedexception-if-running-under-linux-or-macos)) for rendering.
@ -70,7 +70,7 @@ This package can be included in the SVG component if you roll your own version f
This can be achieved by altering the `Svg.csproj` file and un-comment the following block of code:
```
<!--
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.2'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.8.64" />
</ItemGroup>
-->

Просмотреть файл

@ -128,7 +128,7 @@ On macOS, add a reference to the runtime.osx.10.10-x64.CoreCompat.System.Drawing
When building from source-code you can also uncomment the
```
<!-- <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.2'">
<!-- <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.6.20" />
</ItemGroup> -->
```