Merge pull request #510 from mono/dev/elmsharp-sample

Added an ElmSharp sample for Tizen
This commit is contained in:
Matthew Leibowitz 2018-05-08 18:56:17 +02:00 коммит произвёл GitHub
Родитель 3e309d4c3d 605946352e
Коммит f91da2382e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 209 добавлений и 36 удалений

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

@ -160,9 +160,10 @@ var CreateSamplesZip = new Action<DirectoryPath, DirectoryPath> ((samplesDirPath
Force = true, Force = true,
Recursive = true Recursive = true
}; };
DeleteDirectories (GetDirectories ($"{workingDir}/**/bin"), settings); DeleteDirectories (GetDirectories ($"{workingDir}/*/*/*/bin"), settings);
DeleteDirectories (GetDirectories ($"{workingDir}/**/obj"), settings); DeleteDirectories (GetDirectories ($"{workingDir}/*/*/*/obj"), settings);
DeleteDirectories (GetDirectories ($"{workingDir}/**/AppPackages"), settings); DeleteDirectories (GetDirectories ($"{workingDir}/*/*/*/AppPackages"), settings);
DeleteDirectories (GetDirectories ($"{workingDir}/*/*/.vs"), settings);
// make sure the paths are in the correct format for comparison // make sure the paths are in the correct format for comparison
var dpc = System.IO.Path.DirectorySeparatorChar; var dpc = System.IO.Path.DirectorySeparatorChar;

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

@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SkiaSharp.Views.Shared", "..\..\..\source\SkiaSharp.Views\SkiaSharp.Views.Shared\SkiaSharp.Views.Shared.shproj", "{5A67972C-1C04-4913-9950-06A03BFE9533}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Binding", "..\..\..\binding\Binding\Binding.shproj", "{9C502B9A-25D4-473F-89BD-5A13DDE16354}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Binding.Shared", "..\..\..\binding\Binding.Shared\Binding.Shared.shproj", "{6F8349DC-90AC-441D-8B8B-BE623F46BE6D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Tizen", "..\..\..\binding\SkiaSharp.Tizen\SkiaSharp.Tizen.csproj", "{A7B25831-3EA3-4F88-AA82-4D4CA66B19C6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Tizen", "..\..\..\source\SkiaSharp.Views\SkiaSharp.Views.Tizen\SkiaSharp.Views.Tizen.csproj", "{E0AAA975-BCF0-46F9-8E95-407FD6931850}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharpSample", "SkiaSharpSample\SkiaSharpSample.csproj", "{875CA172-1A84-48A7-A55D-A92AC9A56CA6}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\..\..\source\SkiaSharp.Views\SkiaSharp.Views.Shared\SkiaSharp.Views.Shared.projitems*{5a67972c-1c04-4913-9950-06a03bfe9533}*SharedItemsImports = 13
..\..\..\binding\Binding.Shared\Binding.Shared.projitems*{6f8349dc-90ac-441d-8b8b-be623f46be6d}*SharedItemsImports = 13
..\..\..\binding\Binding\Binding.projitems*{9c502b9a-25d4-473f-89bd-5a13dde16354}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A7B25831-3EA3-4F88-AA82-4D4CA66B19C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A7B25831-3EA3-4F88-AA82-4D4CA66B19C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7B25831-3EA3-4F88-AA82-4D4CA66B19C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7B25831-3EA3-4F88-AA82-4D4CA66B19C6}.Release|Any CPU.Build.0 = Release|Any CPU
{E0AAA975-BCF0-46F9-8E95-407FD6931850}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0AAA975-BCF0-46F9-8E95-407FD6931850}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0AAA975-BCF0-46F9-8E95-407FD6931850}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0AAA975-BCF0-46F9-8E95-407FD6931850}.Release|Any CPU.Build.0 = Release|Any CPU
{875CA172-1A84-48A7-A55D-A92AC9A56CA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{875CA172-1A84-48A7-A55D-A92AC9A56CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{875CA172-1A84-48A7-A55D-A92AC9A56CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{875CA172-1A84-48A7-A55D-A92AC9A56CA6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {67EACD19-0CEA-4127-9842-549AA6FB84C9}
EndGlobalSection
EndGlobal

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

@ -0,0 +1,79 @@
using System;
using ElmSharp;
using Tizen.Applications;
using SkiaSharp;
using SkiaSharp.Views.Tizen;
namespace SkiaSharpSample
{
public class App : CoreUIApplication
{
public static void Main(string[] args)
{
Elementary.Initialize();
Elementary.ThemeOverlay();
var app = new App();
app.Run(args);
}
protected override void OnCreate()
{
base.OnCreate();
Initialize();
}
private void Initialize()
{
var window = new Window("ElmSharpApp");
window.BackButtonPressed += OnBackButtonPressed;
window.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90;
window.Show();
var skiaView = new SKCanvasView(window);
skiaView.PaintSurface += OnPaintSurface;
skiaView.Show();
var conformant = new Conformant(window);
conformant.Show();
conformant.SetContent(skiaView);
}
private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
var skiaView = sender as SKCanvasView;
var geo = skiaView.Geometry.ToSKRect();
// the the canvas and properties
var canvas = e.Surface.Canvas;
// get the screen density for scaling
var scale = e.Info.Width / geo.Width;
// handle the device screen density
canvas.Scale(scale);
// make sure the canvas is blank
canvas.Clear(SKColors.White);
// draw some text
var paint = new SKPaint
{
Color = SKColors.Black,
IsAntialias = true,
Style = SKPaintStyle.Fill,
TextAlign = SKTextAlign.Center,
TextSize = 24
};
var coord = new SKPoint(geo.Width / 2f, (geo.Height + paint.TextSize) / 2f);
canvas.DrawText("SkiaSharp", coord, paint);
}
private void OnBackButtonPressed(object sender, EventArgs e)
{
Exit();
}
}
}

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

@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>tizen40</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>None</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Tizen.NET" Version="4.0.0" ExcludeAssets="Runtime" />
<PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\source\SkiaSharp.Views\SkiaSharp.Views.Tizen\SkiaSharp.Views.Tizen.csproj" />
<ProjectReference Include="..\..\..\..\binding\SkiaSharp.Tizen\SkiaSharp.Tizen.csproj" />
</ItemGroup>
<ItemGroup>
<!--
<None Include="..\..\..\..\output\native\tizen\i386\libSkiaSharp.so">
<Link>tpkroot\bin\runtimes\tizen-x86\native\libSkiaSharp.so</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
-->
<None Include="..\..\..\..\output\native\tizen\armel\libSkiaSharp.so">
<Link>tpkroot\bin\runtimes\tizen-armel\native\libSkiaSharp.so</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="..\..\..\..\output\SkiaSharp\nuget\build\tizen40\SkiaSharp.targets" Condition="Exists('..\..\..\..\output\SkiaSharp\nuget\build\tizen40\SkiaSharp.targets')" />
</Project>

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

После

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

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

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.tizen.example.SkiaSharpSample" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="org.tizen.example.SkiaSharpSample" exec="SkiaSharpSample.dll" multiple="false" nodisplay="false" taskmanage="true" splash-screen-display="true" type="dotnet" launch_mode="single">
<label>SkiaSharpSample</label>
<icon>SkiaSharpSample.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
<provides-appdefined-privileges />
</manifest>

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

@ -0,0 +1,21 @@
using Xamarin.Forms.Platform.Tizen;
namespace SkiaSharpSample
{
public class Program : FormsApplication
{
public static void Main(string[] args)
{
var app = new Program();
Forms.Init(app);
app.Run(args);
}
protected override void OnCreate()
{
base.OnCreate();
LoadApplication(new App());
}
}
}

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

@ -1,21 +0,0 @@
using System;
namespace SkiaSharpSample
{
class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
{
protected override void OnCreate()
{
base.OnCreate();
LoadApplication(new App());
}
static void Main(string[] args)
{
var app = new Program();
global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
app.Run(args);
}
}
}

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

@ -1,15 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="4" package="org.tizen.example.SkiaSharpSample" version="1.0.0"> <manifest package="org.tizen.example.SkiaSharpSample" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">
<profile name="common" /> <profile name="common" />
<ui-application appid="org.tizen.example.SkiaSharpSample" <ui-application appid="org.tizen.example.SkiaSharpSample" exec="SkiaSharpSample.dll" multiple="false" nodisplay="false" taskmanage="true" splash-screen-display="true" type="dotnet" launch_mode="single">
exec="SkiaSharpSample.dll"
type="dotnet"
multiple="false"
taskmanage="true"
nodisplay="false"
launch_mode="single">
<label>SkiaSharpSample</label> <label>SkiaSharpSample</label>
<icon>SkiaSharpSample.png</icon> <icon>SkiaSharpSample.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" /> <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application> </ui-application>
<provides-appdefined-privileges />
</manifest> </manifest>