Skip to content

Commit

Permalink
Merge pull request #118 from JoonghyunCho/add-tizen-support
Browse files Browse the repository at this point in the history
Add Tizen support
  • Loading branch information
sthewissen committed Aug 7, 2020
2 parents 6b517fb + 67bf2b8 commit a40d182
Show file tree
Hide file tree
Showing 19 changed files with 478 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using Xamarin.Forms;

namespace Thewissen.PancakeViewSample.Tizen
{
class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
{
protected override void OnCreate()
{
base.OnCreate();
ElmSharp.Utility.AppendGlobalFontPath(this.DirectoryInfo.Resource);
MainWindow.IndicatorMode = ElmSharp.IndicatorMode.Hide;
var app = new App();
app.MainPage.BackgroundColor = Color.White;
LoadApplication(app);
}

static void Main(string[] args)
{
var app = new Program();
Forms.Init(app, true);
app.Run(args);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Tizen.NET.Sdk/1.0.9">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>tizen40</TargetFramework>
<CopyLocalRuntimeTargetAssets Condition="'$(CopyLocalRuntimeTargetAssets)' == ''">true</CopyLocalRuntimeTargetAssets>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>None</DebugType>
</PropertyGroup>

<!-- PackageReference as a workaround for SkiaSharp to be run on Tizen 4.0 Emulator -->
<ItemGroup>
<PackageReference Include="SkiaSharp.Views.Forms" Version="1.68.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Thewissen.PancakeViewSample\Thewissen.PancakeViewSample.csproj" />
</ItemGroup>

</Project>
Binary file not shown.
Binary file not shown.
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.
13 changes: 13 additions & 0 deletions example/Thewissen.PancakeViewSample.Tizen/tizen-manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.tizen.example.Thewissen.PancakeViewSample.Tizen" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="org.tizen.example.Thewissen.PancakeViewSample.Tizen" exec="Thewissen.PancakeViewSample.Tizen.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
<label>Thewissen.PancakeViewSample.Tizen</label>
<icon>Thewissen.PancakeViewSample.Tizen.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
<splash-screens />
</ui-application>
<shortcut-list />
<dependencies />
<provides-appdefined-privileges />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1080" />
<PackageReference Include="PropertyChanged.Fody" Version="3.2.8" />
<PackageReference Include="Fody" Version="6.2.0">
<PackageReference Include="Fody" Version="6.2.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using SkiaSharp;

namespace Xamarin.Forms.PancakeView.Tizen
{
public static class DrawingExtensions
{
static public SKPath CreateRoundedRectPath(int left, int top, int width, int height, CornerRadius cornerRadius)
{
var path = new SKPath();
var skRoundRect = new SKRoundRect(new SKRect(left, top, width, height));
SKPoint[] radii = new SKPoint[4]
{
new SKPoint((float)cornerRadius.TopLeft, (float)cornerRadius.TopLeft),
new SKPoint((float)cornerRadius.TopRight, (float)cornerRadius.TopRight),
new SKPoint((float)cornerRadius.BottomRight, (float)cornerRadius.BottomRight),
new SKPoint((float)cornerRadius.BottomLeft, (float)cornerRadius.BottomLeft)
};
skRoundRect.SetRectRadii(skRoundRect.Rect, radii);
path.AddRoundRect(skRoundRect);
path.Close();
return path;
}

public static SKPath CreatePolygonPath(float rectWidth, float rectHeight, int sides, double cornerRadius = 0.0, double rotationOffset = 0.0)
{
var offsetRadians = rotationOffset * Math.PI / 180;
var path = new SKPath();
var theta = 2 * Math.PI / sides;

var width = (-cornerRadius + Math.Min(rectWidth, rectHeight)) / 2;
var center = new Point(rectWidth / 2, rectHeight / 2);

var radius = width + cornerRadius - (Math.Cos(theta) * cornerRadius) / 2;

var angle = offsetRadians;
var corner = new Point(center.X + (radius - cornerRadius) * Math.Cos(angle), center.Y + (radius - cornerRadius) * Math.Sin(angle));
path.MoveTo((float)(corner.X + cornerRadius * Math.Cos(angle + theta)), (float)(corner.Y + cornerRadius * Math.Sin(angle + theta)));

for (var i = 0; i < sides; i++)
{
angle += theta;
corner = new Point(center.X + (radius - cornerRadius) * Math.Cos(angle), center.Y + (radius - cornerRadius) * Math.Sin(angle));
var tip = new Point(center.X + radius * Math.Cos(angle), center.Y + radius * Math.Sin(angle));
var start = new Point(corner.X + cornerRadius * Math.Cos(angle - theta), corner.Y + cornerRadius * Math.Sin(angle - theta));
var end = new Point(corner.X + cornerRadius * Math.Cos(angle + theta), corner.Y + cornerRadius * Math.Sin(angle + theta));

path.LineTo((float)start.X, (float)start.Y);
path.QuadTo((float)tip.X, (float)tip.Y, (float)end.X, (float)end.Y);
}

path.Close();
return path;
}
}
}
13 changes: 13 additions & 0 deletions src/Xamarin.Forms.PancakeView.Multi/Platforms/Tizen/Interop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;

namespace Xamarin.Forms.PancakeView.Tizen
{
internal static class Interop
{
const string Evas = "libevas.so.1";

[DllImport(Evas)]
internal static extern void evas_object_clip_unset(IntPtr obj);
}
}
Loading

0 comments on commit a40d182

Please sign in to comment.