Modified UIX libs to allow use from UWP

This commit is contained in:
Yoshi Askharoun
2021-07-15 22:00:36 -05:00
parent dd63b8d273
commit c3d90fccbd
27 changed files with 326 additions and 173 deletions
@@ -3,6 +3,12 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
@@ -13,5 +19,9 @@
<ItemGroup>
<UpToDateCheckInput Include="..\..\Xune.Uno.Shared\**\*.xaml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\UIX.RenderApi.Skia\UIX.RenderApi.Skia.csproj" />
<ProjectReference Include="..\..\..\UIX.Skia\UIX.Skia.csproj" />
</ItemGroup>
<Import Project="..\..\Xune.Uno.Shared\Xune.Uno.Shared.projitems" Label="Shared" />
</Project>
+30 -2
View File
@@ -1,11 +1,15 @@
using SkiaSharp;
using SkiaSharp.Views.UWP;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
@@ -23,16 +27,40 @@ namespace Xune.Uno
/// </summary>
public sealed partial class MainPage : Page
{
readonly Random rand = new Random();
DispatcherTimer timer = new DispatcherTimer();
public MainPage()
{
this.InitializeComponent();
Task.Run(Microsoft.Iris.Application.Initialize);
Canvas.PaintSurface += Canvas_PaintSurface;
timer.Interval = new TimeSpan(17000);
timer.Tick += Timer_Tick;
timer.Start();
}
private void Canvas_PaintSurface(object sender, SkiaSharp.Views.UWP.SKPaintSurfaceEventArgs e)
private void Timer_Tick(object sender, object e)
{
e.Surface.Canvas.DrawColor(SKColors.Red);
Canvas.Invalidate();
}
ulong t = 0;
private void Canvas_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
if (t == ulong.MaxValue)
t = 0;
byte r = (byte)rand.Next(0, byte.MaxValue);
byte g = (byte)rand.Next(0, byte.MaxValue);
byte b = (byte)rand.Next(0, byte.MaxValue);
e.Surface.Canvas.DrawColor(new SKColor(100, 50, (byte)(t % byte.MaxValue)));
t++;
}
//private unsafe void nothing()
//{
// void*** ptr = (void***)GCHandle.Alloc(new void*[1], GCHandleType.Pinned).AddrOfPinnedObject();
//}
}
}