Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial port to SkiaSharp 3.0 #209

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<packageSources>
<clear />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="nuget-feed-all" value="https://nuget-feed-all.avaloniaui.net/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
132 changes: 1 addition & 131 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,80 +320,6 @@ SVGC compiles SVG drawing markup to C# using SkiaSharp as rendering engine. SVGC

[![Demo](images/Demo.png)](images/Demo.png)

### Source Generator Usage

Add NuGet package reference to your `csproj`.

```xml
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
```

```xml
<ItemGroup>
<PackageReference Include="Svg.SourceGenerator.Skia" Version="0.5.0" />
</ItemGroup>
```

Include `svg` assets file in your `csproj`.

```xml
<ItemGroup>
<AdditionalFiles Include="Assets/Sample.svg" NamespaceName="Assets" ClassName="Sample" />
</ItemGroup>
```

Use generated `SKPicture` using static `Picture` property from `Sample` class.

```C#
using SkiaSharp;
using Assets;

public void Draw(SKCanvas canvas)
{
canvas.DrawPicture(Sample.Picture);
}
```

### Avalonia Usage

`csproj`
```xml
<ItemGroup>
<AdditionalFiles Include="Assets/__tiger.svg" NamespaceName="AvaloniaSample" ClassName="Tiger" />
</ItemGroup>
```
```xml
<ItemGroup>
<PackageReference Include="Svg.SourceGenerator.Skia" Version="0.5.0" />
<PackageReference Include="Avalonia.Controls.Skia" Version="0.5.0" />
</ItemGroup>
```

`xaml`
```xaml
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AvaloniaSample;assembly=AvaloniaSample"
xmlns:skp="clr-namespace:Avalonia.Controls.Skia;assembly=Avalonia.Controls.Skia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
Width="900" Height="650" WindowStartupLocation="CenterScreen"
x:Class="AvaloniaSample.MainWindow"
Title="AvaloniaSample">
<Window.Resources>
<skp:SKPictureImage x:Key="TigeImage" Source="{x:Static local:Tiger.Picture}" />
</Window.Resources>
<Grid>
<Image Source="{StaticResource TigeImage}" />
</Grid>
</Window>
```

### svgc Usage

```
Expand Down Expand Up @@ -421,16 +347,9 @@ Json File Format
]
```

### Links

* [Source Generators Cookbook](https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md)
* [Source Generators](https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.md)
* [Source Generators Samples](https://github.com/dotnet/roslyn-sdk/tree/master/samples/CSharp/SourceGenerators)
* [Introducing C# Source Generators](https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/)

## Build

To build the projects you need to install [.NET 5.0](https://dotnet.microsoft.com/download/dotnet/5.0) version `SDK 5.0.100`.
To build the projects you need to install [.NET 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) version `SDK 8.0.100`.

```
git clone [email protected]:wieslawsoltes/Svg.Skia.git
Expand All @@ -439,55 +358,6 @@ git submodule update --init --recursive
dotnet build -c Release
```

### Publish Managed

```
cd ./src/Svg.Skia.Converter
dotnet publish -c Release -f net6.0 -r win7-x64 /p:PublishTrimmed=True /p:PublishReadyToRun=True -o Svg.Skia.Converter_net6.0_win7-x64
```

```
cd ./src/Svg.Skia.Converter
dotnet publish -c Release -f net6.0 -r ubuntu.14.04-x64 /p:PublishTrimmed=True /p:PublishReadyToRun=True -o Svg.Skia.Converter_net6.0_ubuntu.14.04-x64
```

```
cd ./src/Svg.Skia.Converter
dotnet publish -c Release -f net6.0 -r osx.10.12-x64 /p:PublishTrimmed=True /p:PublishReadyToRun=True -o Svg.Skia.Converter_net6.0_osx.10.12-x64
```

```
cd ./src/Svg.Skia.Converter
dotnet publish -c Release -f net6.0 -r debian.8-x64 /p:PublishTrimmed=True /p:PublishReadyToRun=True -o Svg.Skia.Converter_net6.0_debian.8-x64
```

```
cd ./src/SvgToPng
dotnet publish -c Release -f net6.0 -r win7-x64 -o SvgToPng_net6.0_win7-x64
```

```
cd ./src/SvgXml.Diagnostics
dotnet publish -c Release -f net6.0 -r win7-x64 -o SvgXml.Diagnostics_net6.0_win7-x64
```

### Publish Native

```
cd ./src/Svg.Skia.Converter
dotnet publish -c Release -f net6.0 -r win-x64 -o Svg.Skia.Converter_net6.0_win-x64
```

```
cd ./src/Svg.Skia.Converter
dotnet publish -c Release -f net6.0 -r linux-x64 -o Svg.Skia.Converter_net6.0_linux-x64
```

```
cd ./src/Svg.Skia.Converter
dotnet publish -c Release -f net6.0 -r osx-x64 -o Svg.Skia.Converter_net6.0_osx-x64
```

## Externals

The `Svg.Skia` library is using code from the https://github.com/vvvv/SVG
Expand Down
22 changes: 0 additions & 22 deletions Svg.Skia.sln
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "props", "props", "{5BFEF4F8
build\Avalonia.ReactiveUI.props = build\Avalonia.ReactiveUI.props
build\Avalonia.Skia.props = build\Avalonia.Skia.props
build\Avalonia.Themes.Fluent.props = build\Avalonia.Themes.Fluent.props
build\Avalonia.Web.props = build\Avalonia.Web.props
build\Base.props = build\Base.props
build\HarfBuzzSharp.NativeAssets.Linux.props = build\HarfBuzzSharp.NativeAssets.Linux.props
build\Newtonsoft.Json.props = build\Newtonsoft.Json.props
Expand Down Expand Up @@ -99,16 +98,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github", "github", "{380E75
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "svgc", "samples\svgc\svgc.csproj", "{6B758C64-5BDA-4842-B0F5-A124D65D83F9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Svg.SourceGenerator.Skia.Sample", "samples\Svg.SourceGenerator.Skia.Sample\Svg.SourceGenerator.Skia.Sample.csproj", "{89FD53A6-8DE6-4733-AF87-EF8660C8EBD3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Svg.Skia.Converter", "samples\Svg.Skia.Converter\Svg.Skia.Converter.csproj", "{68F9524C-BA9F-451D-881D-6192EF2FAAAA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AvaloniaSvgSample", "samples\AvaloniaSvgSample\AvaloniaSvgSample.csproj", "{C3BCD2D5-DFC2-43C1-922D-2E76E6AEF122}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AvaloniaSKPictureImageSample", "samples\AvaloniaSKPictureImageSample\AvaloniaSKPictureImageSample.csproj", "{5A3BC87E-F3F6-4F89-B412-1324CCA2C32B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Svg.SourceGenerator.Skia", "src\Svg.SourceGenerator.Skia\Svg.SourceGenerator.Skia.csproj", "{3049C672-8A3F-4FE4-9973-515B8323B546}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Svg", "src\Avalonia.Svg\Avalonia.Svg.csproj", "{B742F260-0EC6-4805-AE9F-987818CE3CF4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AvaloniaSvgSkiaStylingSample", "samples\AvaloniaSvgSkiaStylingSample\AvaloniaSvgSkiaStylingSample.csproj", "{8A938DC2-1634-4387-BAB3-69F871D54FB5}"
Expand Down Expand Up @@ -179,10 +172,6 @@ Global
{6B758C64-5BDA-4842-B0F5-A124D65D83F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B758C64-5BDA-4842-B0F5-A124D65D83F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B758C64-5BDA-4842-B0F5-A124D65D83F9}.Release|Any CPU.Build.0 = Release|Any CPU
{89FD53A6-8DE6-4733-AF87-EF8660C8EBD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89FD53A6-8DE6-4733-AF87-EF8660C8EBD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89FD53A6-8DE6-4733-AF87-EF8660C8EBD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89FD53A6-8DE6-4733-AF87-EF8660C8EBD3}.Release|Any CPU.Build.0 = Release|Any CPU
{68F9524C-BA9F-451D-881D-6192EF2FAAAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68F9524C-BA9F-451D-881D-6192EF2FAAAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68F9524C-BA9F-451D-881D-6192EF2FAAAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -191,14 +180,6 @@ Global
{C3BCD2D5-DFC2-43C1-922D-2E76E6AEF122}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3BCD2D5-DFC2-43C1-922D-2E76E6AEF122}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3BCD2D5-DFC2-43C1-922D-2E76E6AEF122}.Release|Any CPU.Build.0 = Release|Any CPU
{5A3BC87E-F3F6-4F89-B412-1324CCA2C32B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A3BC87E-F3F6-4F89-B412-1324CCA2C32B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A3BC87E-F3F6-4F89-B412-1324CCA2C32B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A3BC87E-F3F6-4F89-B412-1324CCA2C32B}.Release|Any CPU.Build.0 = Release|Any CPU
{3049C672-8A3F-4FE4-9973-515B8323B546}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3049C672-8A3F-4FE4-9973-515B8323B546}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3049C672-8A3F-4FE4-9973-515B8323B546}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3049C672-8A3F-4FE4-9973-515B8323B546}.Release|Any CPU.Build.0 = Release|Any CPU
{B742F260-0EC6-4805-AE9F-987818CE3CF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B742F260-0EC6-4805-AE9F-987818CE3CF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B742F260-0EC6-4805-AE9F-987818CE3CF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -231,11 +212,8 @@ Global
{BE25FC07-9A8C-4494-A6AE-F2561CF89010} = {B65D5B3A-77BE-4AFF-B502-A136B9C932F8}
{380E7565-C6FF-45C1-A683-E4E1FC744DCC} = {32B4A27D-6FC0-498C-9AD8-5510ACF2C4A1}
{6B758C64-5BDA-4842-B0F5-A124D65D83F9} = {B65D5B3A-77BE-4AFF-B502-A136B9C932F8}
{89FD53A6-8DE6-4733-AF87-EF8660C8EBD3} = {B65D5B3A-77BE-4AFF-B502-A136B9C932F8}
{68F9524C-BA9F-451D-881D-6192EF2FAAAA} = {B65D5B3A-77BE-4AFF-B502-A136B9C932F8}
{C3BCD2D5-DFC2-43C1-922D-2E76E6AEF122} = {B65D5B3A-77BE-4AFF-B502-A136B9C932F8}
{5A3BC87E-F3F6-4F89-B412-1324CCA2C32B} = {B65D5B3A-77BE-4AFF-B502-A136B9C932F8}
{3049C672-8A3F-4FE4-9973-515B8323B546} = {4C42912C-9F8C-43D9-A4B5-4427F7EC8F18}
{B742F260-0EC6-4805-AE9F-987818CE3CF4} = {4C42912C-9F8C-43D9-A4B5-4427F7EC8F18}
{8A938DC2-1634-4387-BAB3-69F871D54FB5} = {B65D5B3A-77BE-4AFF-B502-A136B9C932F8}
EndGlobalSection
Expand Down
2 changes: 1 addition & 1 deletion build/Avalonia.Desktop.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="11.0.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.1.999-cibuild0045834-beta" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/Avalonia.Diagnostics.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.1.999-cibuild0045834-beta" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/Avalonia.ReactiveUI.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.1.999-cibuild0045834-beta" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/Avalonia.Skia.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Skia" Version="11.0.0" />
<PackageReference Include="Avalonia.Skia" Version="11.1.999-cibuild0045834-beta" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions build/Avalonia.Themes.Fluent.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.999-cibuild0045834-beta" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.999-cibuild0045834-beta" />
</ItemGroup>
</Project>
6 changes: 0 additions & 6 deletions build/Avalonia.Web.props

This file was deleted.

2 changes: 1 addition & 1 deletion build/Avalonia.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0" />
<PackageReference Include="Avalonia" Version="11.1.999-cibuild0045834-beta" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions build/Base.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VersionPrefix>1.0.0.13</VersionPrefix>
<VersionPrefix>1.0.0.15</VersionPrefix>
<VersionSuffix></VersionSuffix>
<AvaloniaVersionPrefix>11.0.0.13</AvaloniaVersionPrefix>
<AvaloniaVersionPrefix>11.0.0.15</AvaloniaVersionPrefix>
<AvaloniaVersionSuffix>$(VersionSuffix)</AvaloniaVersionSuffix>
<Authors>Wiesław Šoltés</Authors>
<Company>Wiesław Šoltés</Company>
Expand Down
2 changes: 1 addition & 1 deletion build/HarfBuzzSharp.NativeAssets.Linux.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2.3" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="7.3.0.1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/SkiaSharp.HarfBuzz.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.6" />
<PackageReference Include="SkiaSharp.HarfBuzz" Version="3.0.0-preview.2.1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/SkiaSharp.Linux.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.0.0-preview.2.1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/SkiaSharp.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="2.88.6" />
<PackageReference Include="SkiaSharp" Version="3.0.0-preview.2.1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion externals/SVG
Submodule SVG updated 41 files
+25 −21 .github/workflows/runtests.yml
+2 −0 .gitignore
+9 −226 Generators/AvailableElementsGenerator.cs
+46 −0 Generators/Element.cs
+17 −0 Generators/MemberType.cs
+52 −0 Generators/Property.cs
+25 −0 Generators/PropertyEqualityComparer.cs
+9 −1 Generators/Svg.Generators.csproj
+26 −0 Generators/SyntaxReceiver.cs
+2 −1 Samples/Entities/Entities.csproj
+3 −0 Samples/SVGBuilder/Properties/AssemblyInfo.cs
+3 −2 Samples/SVGBuilder/SVGBuilder.csproj
+3 −0 Samples/SVGViewer/Properties/AssemblyInfo.cs
+3 −2 Samples/SVGViewer/SVGViewer.csproj
+2 −4 Samples/SvgConsole/SvgConsole.csproj
+2 −1 Samples/SvgRuntimeUpdates/SvgRuntimeUpdates.csproj
+1 −1 Source/DataTypes/SvgNumberCollection.cs
+2 −2 Source/DataTypes/SvgPointCollection.cs
+2 −2 Source/DataTypes/SvgUnitConverter.cs
+10 −0 Source/Exceptions/SvgException.cs
+4 −0 Source/Exceptions/SvgGdiPlusCannotBeLoadedException.cs
+4 −0 Source/Exceptions/SvgMemoryException.cs
+5 −0 Source/Generated/Readme.md
+4 −4 Source/Helpers/StringParser.cs
+5 −5 Source/Paths/CoordinateParser.cs
+38 −38 Source/Paths/SvgPathBuilder.cs
+8 −4 Source/Svg.csproj
+7 −9 Source/Svg.sln
+64 −0 Source/SvgModel.cs
+17 −17 Source/Transforms/SvgTransformConverter.cs
+2 −2 Source/version.json
+61 −0 Tests/Svg.Benchmark.sln
+2 −2 Tests/Svg.Benchmark/CoordinateParserBenchmarks.cs
+4 −3 Tests/Svg.Benchmark/Svg.Benchmark.csproj
+8 −3 Tests/Svg.Custom/Svg.Custom.csproj
+2 −1 Tests/Svg.Tests.Common/Svg.Tests.Common.csproj
+61 −0 Tests/Svg.UnitTests.sln
+2 −3 Tests/Svg.UnitTests/Svg.UnitTests.csproj
+3 −0 Tests/SvgW3CTestRunner/Properties/AssemblyInfo.cs
+3 −2 Tests/SvgW3CTestRunner/SvgW3CTestRunner.csproj
+13 −4 doc/ReleaseNotes.md
9 changes: 0 additions & 9 deletions samples/AvaloniaSKPictureImageSample/App.axaml

This file was deleted.

23 changes: 0 additions & 23 deletions samples/AvaloniaSKPictureImageSample/App.axaml.cs

This file was deleted.

Loading
Loading