Skip to content

Commit

Permalink
Added Uno Platform support (#1396)
Browse files Browse the repository at this point in the history
Added the initial Uno implementations, code pulled from:
 - https://github.com/unoplatform/Uno.SkiaSharp
 - #1333

Co-authored-by: Jérôme Laban <[email protected]>
Co-authored-by: Geoffrey Huntley <[email protected]>
Co-authored-by: Martin Zikmund <[email protected]>
  • Loading branch information
4 people authored Jul 13, 2020
1 parent c540eb8 commit 4bc170c
Show file tree
Hide file tree
Showing 150 changed files with 3,742 additions and 28 deletions.
2 changes: 2 additions & 0 deletions VERSIONS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ AtkSharp release 3.22.24.37
System.Memory release 4.5.3
System.IO.UnmanagedMemoryStream release 4.3.0
SharpVk release 0.4.2
Uno.UI release 2.0.532

# additional references used by the tooling
OpenTK.GLControl reference 1.1.2349.61993
Expand Down Expand Up @@ -59,6 +60,7 @@ SkiaSharp.Views.WPF nuget 2.80.1
SkiaSharp.Views.Forms nuget 2.80.1
SkiaSharp.Views.Forms.WPF nuget 2.80.1
SkiaSharp.Views.Forms.GTK nuget 2.80.1
SkiaSharp.Views.Uno nuget 2.80.1
SkiaSharp.HarfBuzz nuget 2.80.1
SkiaSharp.Vulkan.SharpVk nuget 2.80.1
HarfBuzzSharp nuget 2.6.1.6
Expand Down
14 changes: 5 additions & 9 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var TRACKED_NUGETS = new Dictionary<string, Version> {
{ "SkiaSharp.Views.Forms", new Version (1, 57, 0) },
{ "SkiaSharp.Views.Forms.WPF", new Version (1, 57, 0) },
{ "SkiaSharp.Views.Forms.GTK", new Version (1, 57, 0) },
{ "SkiaSharp.Views.Uno", new Version (1, 57, 0) },
{ "HarfBuzzSharp", new Version (1, 0, 0) },
{ "HarfBuzzSharp.NativeAssets.Linux", new Version (1, 0, 0) },
{ "SkiaSharp.HarfBuzz", new Version (1, 57, 0) },
Expand Down Expand Up @@ -133,8 +134,7 @@ Task ("libs")
platform = ".Linux";
}
}
RunMSBuild ($"./source/SkiaSharpSource{platform}.sln",
bl: $"./output/binlogs/libs{platform}.binlog");
RunMSBuild ($"./source/SkiaSharpSource{platform}.sln");

// assemble the mdoc docs
EnsureDirectoryExists ("./output/docs/mdoc/");
Expand All @@ -157,9 +157,7 @@ Task ("tests")

void RunDesktopTest (string arch)
{
RunMSBuild ("./tests/SkiaSharp.Desktop.Tests.sln",
platform: arch == "AnyCPU" ? "Any CPU" : arch,
bl: $"./output/binlogs/tests-desktop.{arch}.binlog");
RunMSBuild ("./tests/SkiaSharp.Desktop.Tests.sln", platform: arch == "AnyCPU" ? "Any CPU" : arch);

// SkiaSharp.Tests.dll
try {
Expand Down Expand Up @@ -194,8 +192,7 @@ Task ("tests")
// .NET Core

// SkiaSharp.NetCore.Tests.csproj
RunMSBuild ("./tests/SkiaSharp.NetCore.Tests.sln",
bl: $"./output/binlogs/tests-netcore.binlog");
RunMSBuild ("./tests/SkiaSharp.NetCore.Tests.sln");
try {
RunNetCoreTests ("./tests/SkiaSharp.NetCore.Tests/SkiaSharp.NetCore.Tests.csproj");
} catch {
Expand Down Expand Up @@ -240,8 +237,7 @@ Task ("tests-wasm")
{
var failedTests = 0;

RunMSBuild ("./tests/SkiaSharp.Wasm.Tests.sln",
bl: $"./output/binlogs/tests-wasm.binlog");
RunMSBuild ("./tests/SkiaSharp.Wasm.Tests.sln");

var pubDir = "./tests/SkiaSharp.Wasm.Tests/bin/publish/";
RunNetCorePublish("./tests/SkiaSharp.Wasm.Tests/SkiaSharp.Wasm.Tests.csproj", pubDir);
Expand Down
5 changes: 5 additions & 0 deletions cake/UtilsManaged.cake
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ async Task<NuGetDiff> CreateNuGetDiffAsync()
await AddDep("GLibSharp", "netstandard2.0");
await AddDep("AtkSharp", "netstandard2.0");
await AddDep("System.Memory", "netstandard2.0");
await AddDep("Uno.UI", "netstandard2.0");
await AddDep("Uno.UI", "MonoAndroid90");
await AddDep("Uno.UI", "xamarinios10");
await AddDep("Uno.UI", "xamarinmac20");
await AddDep("Uno.UI", "UAP");

await AddDep("OpenTK.GLControl", "NET40", "reference");
await AddDep("Xamarin.Forms", "Xamarin.iOS10", "reference");
Expand Down
14 changes: 7 additions & 7 deletions cake/msbuild.cake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void RunMSBuild(
string platformTarget = null,
bool restore = true,
bool restoreOnly = false,
string bl = null)
bool bl = true)
{
var nugetSources = new [] { OUTPUT_NUGETS_PATH.FullPath, "https://api.nuget.org/v3/index.json" };

Expand All @@ -18,12 +18,12 @@ void RunMSBuild(
c.Verbosity = VERBOSITY;
c.MaxCpuCount = 0;

if (!string.IsNullOrEmpty(bl)) {
c.BinaryLogger = new MSBuildBinaryLogSettings {
Enabled = true,
FileName = bl,
};
}
var relativeSolution = MakeAbsolute(ROOT_PATH).GetRelativePath(MakeAbsolute(solution));
var blPath = ROOT_PATH.Combine("output/binlogs").CombineWithFilePath(relativeSolution + ".binlog");
c.BinaryLogger = new MSBuildBinaryLogSettings {
Enabled = true,
FileName = blPath.FullPath,
};

if (!string.IsNullOrEmpty(MSBUILD_EXE)) {
c.ToolPath = MSBUILD_EXE;
Expand Down
67 changes: 67 additions & 0 deletions nuget/SkiaSharp.Views.Uno.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>

<!-- package -->
<id>SkiaSharp.Views.Uno</id>
<title>SkiaSharp for Uno Platform</title>
<version>1.0.0</version>
<description>
SkiaSharp for Uno Platform is a set of views that can be used to draw on the screen.
</description>
<summary>
SkiaSharp for Uno Platform is a set of views that can be used to draw on the screen.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>ui uno xamarin graphics ios android windows uwp macos cross-platform skiasharp</tags>

<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>

<dependencies>
<group targetFramework="monoandroid1.0">
<dependency id="Uno.UI" version="2.0.532" />
<dependency id="SkiaSharp" version="1.0.0" />
</group>
<group targetFramework="xamarinios1.0">
<dependency id="Uno.UI" version="2.0.532" />
<dependency id="SkiaSharp" version="1.0.0" />
</group>
<group targetFramework="xamarinmac2.0">
<dependency id="Uno.UI" version="2.0.532" />
<dependency id="SkiaSharp" version="1.0.0" />
</group>
<group targetFramework="uap10.0">
<dependency id="Uno.UI" version="2.0.532" />
<dependency id="SkiaSharp" version="1.0.0" />
<dependency id="SkiaSharp.Views" version="1.0.0" />
</group>
</dependencies>

</metadata>
<files>

<!-- SkiaSharp.Views.UWP.dll -->
<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" />
<file platform="macos" src="lib/xamarinios1.0/SkiaSharp.Views.UWP.xml" />
<file platform="macos" src="lib/xamarinmac2.0/SkiaSharp.Views.UWP.dll" />
<file platform="macos" src="lib/xamarinmac2.0/SkiaSharp.Views.UWP.xml" />

<!-- the build bits -->
<file src="_._" target="lib/uap10.0/_._" />

<!-- legal -->
<file src="LICENSE.txt" />

</files>
</package>
Binary file not shown.
30 changes: 30 additions & 0 deletions samples/Basic/Uno/SkiaSharpSample.Android/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using Android.App;
using Android.Runtime;
using Com.Nostra13.Universalimageloader.Core;
using Windows.UI.Xaml.Media;

namespace SkiaSharpSample.Droid
{
[Application]
public class Application : Windows.UI.Xaml.NativeApplication
{
public Application(IntPtr javaReference, JniHandleOwnership transfer)
: base(() => new App(), javaReference, transfer)
{
ConfigureUniversalImageLoader();
}

private void ConfigureUniversalImageLoader()
{
// Create global configuration and initialize ImageLoader with this config
var config = new ImageLoaderConfiguration
.Builder(Context)
.Build();

ImageLoader.Instance.Init(config);

ImageSource.DefaultImageLoader = ImageLoader.Instance.LoadImageAsync;
}
}
}
13 changes: 13 additions & 0 deletions samples/Basic/Uno/SkiaSharpSample.Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Android.App;
using Android.Views;

namespace SkiaSharpSample.Droid
{
[Activity(
MainLauncher = true,
ConfigurationChanges = Uno.UI.ActivityHelper.AllConfigChanges,
WindowSoftInputMode = SoftInput.AdjustPan | SoftInput.StateHidden)]
public class MainActivity : Windows.UI.Xaml.ApplicationActivity
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" package="com.companyname.skiasharpsample" android:versionCode="1">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:label="@string/app_name" android:theme="@style/Theme.AppCompat" android:hardwareAccelerated="true"></application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SkiaSharpSample.Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SkiaSharpSample.Android")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2020 Google LLC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ https://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->

<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">SkiaSharp</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2020 Google LLC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ https://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->

<resources>
<color name="ic_launcher_background">#F8F8F8</color>
</resources>
Loading

0 comments on commit 4bc170c

Please sign in to comment.