Skip to content

Commit

Permalink
Add support for SKXamlCanvas on Uno Platform SkiaSharp backends v2.0 (#…
Browse files Browse the repository at this point in the history
…1634) (#1704)

* fix: [Uno] SKXamlCanvas is now a Canvas
* feat: Add support for SKXamlCanvas when running on SkiaSharp based backends
   This enables SKXamlCanvas for Uno Platform's support for for GTK (Linux, Windows, macOS), WPF and Tizen, for Uno 3.6 and later.
* feat: Add Uno Skia samples
* bump uno samples to latest uno.ui for VS 16.10 pre3 changes
* Update Uno all packages
* ci: adjust for wasm net5
* fix: Update WPF sample
* Remove unsupported tizen sample
* chore: Update to Uno.UI 3.7.6 to fix invalid SkiaSharp.Views dependency
* Update llvm to v11.1


Co-authored-by: Jerome Laban <jerome.laban@nventive.com>
  • Loading branch information
mattleibow and jeromelaban committed Jun 11, 2021
1 parent 9fbd2ac commit 80860aa
Show file tree
Hide file tree
Showing 56 changed files with 1,134 additions and 51 deletions.
2 changes: 1 addition & 1 deletion VERSIONS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ System.Memory release 4.5.3
System.IO.UnmanagedMemoryStream release 4.3.0
System.Drawing.Common release 4.5.1
SharpVk release 0.4.2
Uno.UI release 3.7.4
Uno.UI release 3.7.6
Microsoft.ProjectReunion release 0.5.0
Microsoft.ProjectReunion.Foundation release 0.5.0
Microsoft.ProjectReunion.WinUI release 0.5.0
Expand Down
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ DirectoryPath DOCS_PATH = MakeAbsolute(ROOT_PATH.Combine("docs/SkiaSharpAPI"));

var PREVIEW_LABEL = Argument ("previewLabel", EnvironmentVariable ("PREVIEW_LABEL") ?? "preview");
var FEATURE_NAME = EnvironmentVariable ("FEATURE_NAME") ?? "";
var BUILD_NUMBER = EnvironmentVariable ("BUILD_NUMBER") ?? "0";
var BUILD_NUMBER = Argument ("buildNumber", EnvironmentVariable ("BUILD_NUMBER") ?? "0");
var GIT_SHA = Argument ("gitSha", EnvironmentVariable ("GIT_SHA") ?? "");
var GIT_BRANCH_NAME = Argument ("gitBranch", EnvironmentVariable ("GIT_BRANCH_NAME") ?? "");

Expand Down
6 changes: 6 additions & 0 deletions native/windows/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ bool SUPPORT_VULKAN = SUPPORT_VULKAN_VAR == "1" || SUPPORT_VULKAN_VAR.ToLower ()

string VARIANT = BUILD_VARIANT ?? "windows";

Information("Native Arguments:");
Information($" {"LLVM_HOME".PadRight(30)} {{0}}", LLVM_HOME);
Information($" {"SUPPORT_VULKAN".PadRight(30)} {{0}}", SUPPORT_VULKAN);
Information($" {"VARIANT".PadRight(30)} {{0}}", VARIANT);
Information($" {"CONFIGURATION".PadRight(30)} {{0}}", CONFIGURATION);

Task("libSkiaSharp")
.IsDependentOn("git-sync-deps")
.WithCriteria(IsRunningOnWindows())
Expand Down
12 changes: 7 additions & 5 deletions nuget/SkiaSharp.Views.Uno.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release

<dependencies>
<group targetFramework="netstandard2.0">
<dependency id="Uno.UI" version="3.7.4" />
<dependency id="Uno.UI" version="3.7.6" />
<dependency id="SkiaSharp" version="1.0.0" />
<dependency id="SkiaSharp.NativeAssets.WebAssembly" version="1.0.0" />
</group>
<group targetFramework="monoandroid1.0">
<dependency id="Uno.UI" version="3.7.4" />
<dependency id="Uno.UI" version="3.7.6" />
<dependency id="SkiaSharp" version="1.0.0" />
</group>
<group targetFramework="xamarinios1.0">
<dependency id="Uno.UI" version="3.7.4" />
<dependency id="Uno.UI" version="3.7.6" />
<dependency id="SkiaSharp" version="1.0.0" />
</group>
<group targetFramework="xamarinmac2.0">
<dependency id="Uno.UI" version="3.7.4" />
<dependency id="Uno.UI" version="3.7.6" />
<dependency id="SkiaSharp" version="1.0.0" />
</group>
<group targetFramework="uap10.0">
<dependency id="Uno.UI" version="3.7.4" />
<dependency id="Uno.UI" version="3.7.6" />
<dependency id="SkiaSharp" version="1.0.0" />
<dependency id="SkiaSharp.Views" version="1.0.0" />
</group>
Expand All @@ -59,6 +59,8 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<file src="lib/netstandard2.0/SkiaSharp.Views.UWP.xml" />
<file src="uno-runtime/webassembly/SkiaSharp.Views.UWP.dll" />
<file src="uno-runtime/webassembly/SkiaSharp.Views.UWP.xml" />
<file src="uno-runtime/skia/SkiaSharp.Views.UWP.dll" />
<file src="uno-runtime/skia/SkiaSharp.Views.UWP.xml" />
<file platform="macos,windows" src="lib/monoandroid1.0/SkiaSharp.Views.UWP.dll" />
<file platform="macos,windows" src="lib/monoandroid1.0/SkiaSharp.Views.UWP.xml" />
<file platform="macos" src="lib/xamarinios1.0/SkiaSharp.Views.UWP.dll" />
Expand Down
3 changes: 0 additions & 3 deletions nuget/SkiaSharp.Views.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<copyright>© Microsoft Corporation. All rights reserved.</copyright>

<dependencies>
<group>
<dependency id="SkiaSharp" version="1.0.0" />
</group>
<group targetFramework="net462">
<dependency id="SkiaSharp" version="1.0.0" />
<dependency id="SkiaSharp.Views.Desktop.Common" version="1.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
<Reference Include="Mono.Android.Export" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Uno.UI" Version="3.7.4" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.4" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI" Version="3.7.6" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.6" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.33" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
<PackageReference Include="Uno.UI.WebAssembly" Version="3.7.4" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.4" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.WebAssembly" Version="3.7.6" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.6" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="2.1.0" />
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="2.1.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Uno.UI" Version="3.7.4" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.4" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI" Version="3.7.6" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.6" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<Reference Include="System.Memory" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Uno.UI" Version="3.7.4" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.4" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI" Version="3.7.6" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.6" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions samples/Gallery/PlatformShared/SamplesInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.IO;
using System.Linq;
using Xamarin.Essentials;
#if __WASM__
#if __WASM__ || HAS_UNO_SKIA
using System.Runtime.InteropServices;
using Windows.ApplicationModel;
using Windows.Storage;
Expand Down Expand Up @@ -47,7 +47,7 @@ public static void Init()
{
var fontName = "content-font.ttf";

#if WINDOWS_UWP
#if WINDOWS_UWP || HAS_UNO_SKIA
var pkg = Package.Current.InstalledLocation.Path;
var path = Path.Combine(pkg, "Assets", "Media", fontName);
#elif __IOS__ || __TVOS__ || __MACOS__
Expand Down Expand Up @@ -86,7 +86,7 @@ public static void Init()
var localStorage = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
#elif __DESKTOP__
var localStorage = System.Windows.Forms.Application.LocalUserAppDataPath;
#elif __WASM__
#elif __WASM__ || HAS_UNO_SKIA
var localStorage = ApplicationData.Current.LocalFolder.Path;
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Essentials" Version="1.5.1" />
<PackageReference Include="Uno.UI" Version="3.7.4" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.4" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI" Version="3.7.6" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.6" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.33" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
Expand Down
Binary file not shown.
24 changes: 24 additions & 0 deletions samples/Gallery/Uno/SkiaSharpSample.Gtk/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using GLib;
using Uno.UI.Runtime.Skia;

namespace SkiaSharpSample.Gtk
{
class Program
{
static void Main(string[] args)
{
SkiaSharp.Views.UWP.SKSwapChainPanel.RaiseOnUnsupported = false;

ExceptionManager.UnhandledException += delegate (UnhandledExceptionArgs expArgs)
{
Console.WriteLine("GLIB UNHANDLED EXCEPTION" + expArgs.ExceptionObject.ToString());
expArgs.ExitApplication = true;
};

var host = new GtkHost(() => new App(), args);

host.Run();
}
}
}
39 changes: 39 additions & 0 deletions samples/Gallery/Uno/SkiaSharpSample.Gtk/SkiaSharpSample.Gtk.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType Condition="'$(Configuration)'=='Release'">WinExe</OutputType>
<OutputType Condition="'$(Configuration)'=='Debug'">Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup Condition="exists('..\SkiaSharpSample.UWP')">
<EmbeddedResource Include="..\SkiaSharpSample.UWP\Package.appxmanifest" LogicalName="Package.appxmanifest" />
<Content Include="..\SkiaSharpSample.UWP\Assets\StoreLogo.scale-400.png" Link="Assets\StoreLogo.png" />
<Content Include="Assets\Fonts\uno-fluentui-assets.ttf" />
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Include="..\SkiaSharpSample.Shared\**\*.xaml" />
</ItemGroup>
<ItemGroup>
<!-- Note that for WebAssembly version 1.1.1 of the console logger required -->
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
<PackageReference Include="Uno.UI.Skia.Gtk" Version="3.7.6" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.7.6" Condition="'$(Configuration)'=='Debug'" />
</ItemGroup>
<Import Project="..\SkiaSharpSample.Shared\SkiaSharpSample.Shared.projitems" Label="Shared" />
<ItemGroup>
<ProjectReference Include="..\..\..\..\binding\SkiaSharp\SkiaSharp.csproj" />
<ProjectReference Include="..\..\..\..\binding\HarfBuzzSharp\HarfBuzzSharp.csproj" />
<ProjectReference Include="..\..\..\..\source\SkiaSharp.Views.Uno\SkiaSharp.Views.Uno.Skia\SkiaSharp.Views.Uno.Skia.csproj" />
<ProjectReference Include="..\..\..\..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\..\..\output\native\windows\x64\*.dll" Visible="False" />
<Content Include="..\..\..\..\output\native\linux\x64\*.so" Visible="False" />
<Content Include="..\..\..\..\output\native\osx\*.dylib" Visible="False" />
<Content Include="..\..\Shared\Media\content-font.ttf">
<Link>Assets\Media\content-font.ttf</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="..\..\..\..\output\SkiaSharp.Views.Uno\nuget\build\netstandard2.0\SkiaSharp.Views.Uno.targets" Condition="Exists('..\..\..\..\output\SkiaSharp.Views.Uno\nuget\build\netstandard2.0\SkiaSharp.Views.Uno.targets')" />
</Project>
18 changes: 18 additions & 0 deletions samples/Gallery/Uno/SkiaSharpSample.Linux.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Uno.Wasm",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp", "..\..\..\binding\SkiaSharp\SkiaSharp.csproj", "{409AF271-D8B7-4F79-B293-02F562A51955}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Uno.Skia", "..\..\..\source\SkiaSharp.Views.Uno\SkiaSharp.Views.Uno.Skia\SkiaSharp.Views.Uno.Skia.csproj", "{E9507AEE-7C7C-4495-9698-D95DEBAA2AD0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.HarfBuzz", "..\..\..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj", "{D0580308-2C5A-4B6D-8884-25CA3A5AD304}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HarfBuzzSharp", "..\..\..\binding\HarfBuzzSharp\HarfBuzzSharp.csproj", "{42F0E7DE-941E-4348-ACDE-7DCF61D05E6B}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
SkiaSharpSample.Shared\SkiaSharpSample.Shared.projitems*{6279c845-92f8-4333-ab99-3d213163593c}*SharedItemsImports = 13
Expand All @@ -33,6 +39,18 @@ Global
{409AF271-D8B7-4F79-B293-02F562A51955}.Debug|Any CPU.Build.0 = Debug|Any CPU
{409AF271-D8B7-4F79-B293-02F562A51955}.Release|Any CPU.ActiveCfg = Release|Any CPU
{409AF271-D8B7-4F79-B293-02F562A51955}.Release|Any CPU.Build.0 = Release|Any CPU
{E9507AEE-7C7C-4495-9698-D95DEBAA2AD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9507AEE-7C7C-4495-9698-D95DEBAA2AD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9507AEE-7C7C-4495-9698-D95DEBAA2AD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9507AEE-7C7C-4495-9698-D95DEBAA2AD0}.Release|Any CPU.Build.0 = Release|Any CPU
{D0580308-2C5A-4B6D-8884-25CA3A5AD304}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0580308-2C5A-4B6D-8884-25CA3A5AD304}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0580308-2C5A-4B6D-8884-25CA3A5AD304}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0580308-2C5A-4B6D-8884-25CA3A5AD304}.Release|Any CPU.Build.0 = Release|Any CPU
{42F0E7DE-941E-4348-ACDE-7DCF61D05E6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42F0E7DE-941E-4348-ACDE-7DCF61D05E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42F0E7DE-941E-4348-ACDE-7DCF61D05E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42F0E7DE-941E-4348-ACDE-7DCF61D05E6B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading

0 comments on commit 80860aa

Please sign in to comment.