23 changed files with 63 additions and 630 deletions
@ -1,7 +0,0 @@ |
|||
|
|||
namespace Avalonia.Skia.Android.TestApp |
|||
{ |
|||
public class App : Application |
|||
{ |
|||
} |
|||
} |
|||
@ -1,138 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProductVersion>8.0.30703</ProductVersion> |
|||
<SchemaVersion>2.0</SchemaVersion> |
|||
<ProjectGuid>{F92E55A5-ED73-4CCB-AB4B-0541B6757F31}</ProjectGuid> |
|||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>Avalonia.Skia.Android.TestApp</RootNamespace> |
|||
<AssemblyName>Avalonia.Skia.Android.TestApp</AssemblyName> |
|||
<FileAlignment>512</FileAlignment> |
|||
<AndroidApplication>true</AndroidApplication> |
|||
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile> |
|||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> |
|||
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk> |
|||
<TargetFrameworkVersion>v4.4</TargetFrameworkVersion> |
|||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<DebugSymbols>True</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime> |
|||
<AndroidLinkMode>None</AndroidLinkMode> |
|||
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk> |
|||
<BundleAssemblies>False</BundleAssemblies> |
|||
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi> |
|||
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86</AndroidSupportedAbis> |
|||
<Debugger>Xamarin</Debugger> |
|||
<AndroidEnableMultiDex>False</AndroidEnableMultiDex> |
|||
<DevInstrumentationEnabled>True</DevInstrumentationEnabled> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime> |
|||
<AndroidLinkMode>Full</AndroidLinkMode> |
|||
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk> |
|||
<BundleAssemblies>False</BundleAssemblies> |
|||
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi> |
|||
<Debugger>Xamarin</Debugger> |
|||
<AotAssemblies>False</AotAssemblies> |
|||
<EnableLLVM>False</EnableLLVM> |
|||
<AndroidEnableMultiDex>False</AndroidEnableMultiDex> |
|||
<EnableProguard>False</EnableProguard> |
|||
<DebugSymbols>False</DebugSymbols> |
|||
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86</AndroidSupportedAbis> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="Mono.Android" /> |
|||
<Reference Include="mscorlib" /> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Collections" /> |
|||
<Reference Include="System.Core" /> |
|||
<Reference Include="System.Runtime" /> |
|||
<Reference Include="System.Xml.Linq" /> |
|||
<Reference Include="System.Xml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="App.cs" /> |
|||
<Compile Include="MainActivity.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="Resources\Resource.Designer.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Include="Properties\AndroidManifest.xml" /> |
|||
<AndroidResource Include="Resources\layout\Main.axml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\Android\Avalonia.Android\Avalonia.Android.csproj"> |
|||
<Project>{7b92af71-6287-4693-9dcb-bd5b6e927e23}</Project> |
|||
<Name>Avalonia.Android</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Avalonia.Animation\Avalonia.Animation.csproj"> |
|||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|||
<Name>Avalonia.Animation</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Avalonia.Base\Avalonia.Base.csproj"> |
|||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
|||
<Name>Avalonia.Base</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Avalonia.Controls\Avalonia.Controls.csproj"> |
|||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
|||
<Name>Avalonia.Controls</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj"> |
|||
<Project>{4a1abb09-9047-4bd5-a4ad-a055e52c5ee0}</Project> |
|||
<Name>Avalonia.DotNetFrameworkRuntime</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Avalonia.Input\Avalonia.Input.csproj"> |
|||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|||
<Name>Avalonia.Input</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
|||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|||
<Name>Avalonia.Interactivity</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Avalonia.Layout\Avalonia.Layout.csproj"> |
|||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|||
<Name>Avalonia.Layout</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|||
<Name>Avalonia.Visuals</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Avalonia.Styling\Avalonia.Styling.csproj"> |
|||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|||
<Name>Avalonia.Styling</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\Avalonia.Skia.Android\Avalonia.Skia.Android.csproj"> |
|||
<Project>{bd43f7c0-396b-4aa1-bad9-dfde54d51298}</Project> |
|||
<Name>Avalonia.Skia.Android</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<AndroidResource Include="Resources\drawable\Icon.png" /> |
|||
<AndroidResource Include="Resources\values\Strings.xml" /> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> |
|||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
|||
Other similar extension points exist, see Microsoft.Common.targets. |
|||
<Target Name="BeforeBuild"> |
|||
</Target> |
|||
<Target Name="AfterBuild"> |
|||
</Target> |
|||
--> |
|||
</Project> |
|||
@ -1,26 +0,0 @@ |
|||
<ProjectConfiguration> |
|||
<AutoDetectNugetBuildDependencies>true</AutoDetectNugetBuildDependencies> |
|||
<BuildPriority>1000</BuildPriority> |
|||
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace> |
|||
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing> |
|||
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies> |
|||
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking> |
|||
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking> |
|||
<AllowCodeAnalysis>false</AllowCodeAnalysis> |
|||
<IgnoreThisComponentCompletely>true</IgnoreThisComponentCompletely> |
|||
<RunPreBuildEvents>false</RunPreBuildEvents> |
|||
<RunPostBuildEvents>false</RunPostBuildEvents> |
|||
<PreviouslyBuiltSuccessfully>false</PreviouslyBuiltSuccessfully> |
|||
<InstrumentAssembly>true</InstrumentAssembly> |
|||
<PreventSigningOfAssembly>false</PreventSigningOfAssembly> |
|||
<AnalyseExecutionTimes>true</AnalyseExecutionTimes> |
|||
<DetectStackOverflow>true</DetectStackOverflow> |
|||
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace> |
|||
<DefaultTestTimeout>60000</DefaultTestTimeout> |
|||
<UseBuildConfiguration /> |
|||
<UseBuildPlatform /> |
|||
<ProxyProcessPath /> |
|||
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture> |
|||
<MSTestThreadApartmentState>STA</MSTestThreadApartmentState> |
|||
<BuildProcessArchitecture>x86</BuildProcessArchitecture> |
|||
</ProjectConfiguration> |
|||
@ -1,78 +0,0 @@ |
|||
using Android.App; |
|||
using Android.OS; |
|||
using Android.Views; |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Media; |
|||
|
|||
namespace Avalonia.Skia.Android.TestApp |
|||
{ |
|||
[Activity(Label = "Avalonia.Skia.Android.TestApp", MainLauncher = true, Icon = "@drawable/icon")] |
|||
public class MainActivity : Activity |
|||
{ |
|||
|
|||
protected override void OnCreate(Bundle bundle) |
|||
{ |
|||
base.OnCreate(bundle); |
|||
|
|||
App app; |
|||
if (Avalonia.Application.Current != null) |
|||
app = (App)Avalonia.Application.Current; |
|||
else |
|||
{ |
|||
app = new App(); |
|||
AppBuilder.Configure(app) |
|||
.UseAndroid() |
|||
.UseSkia() |
|||
.SetupWithoutStarting(); |
|||
} |
|||
|
|||
SetContentView(new MainView(this)); |
|||
} |
|||
|
|||
class MainView : SkiaRenderView |
|||
{ |
|||
float _radians = 0; |
|||
public MainView(Activity context) : base(context) |
|||
{ |
|||
} |
|||
|
|||
protected override void OnRender(DrawingContext ctx) |
|||
{ |
|||
ctx.FillRectangle(Brushes.Green, new Rect(0, 0, Width, Height)); |
|||
|
|||
var rc = new Rect(0, 0, Width/3, Height/3); |
|||
using (ctx.PushPostTransform( |
|||
Avalonia.Matrix.CreateTranslation(-Width/6, -Width/6)* |
|||
Avalonia.Matrix.CreateRotation(_radians)* |
|||
Avalonia.Matrix.CreateTranslation(Width/2, Height/2))) |
|||
{ |
|||
ctx.FillRectangle(new LinearGradientBrush() |
|||
{ |
|||
GradientStops = |
|||
{ |
|||
new GradientStop() {Color = Colors.Blue}, |
|||
new GradientStop(Colors.Red, 1) |
|||
} |
|||
}, rc, 5); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
public override bool OnTouchEvent(MotionEvent e) |
|||
{ |
|||
if (e.Action == MotionEventActions.Down) |
|||
return true; |
|||
if (e.Action == MotionEventActions.Move) |
|||
{ |
|||
_radians = (e.RawY + e.RawY)/100; |
|||
Invalidate(); |
|||
return true; |
|||
} |
|||
return base.OnTouchEvent(e); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,5 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Avalonia.Skia.Android.TestApp" android:versionCode="1" android:versionName="1.0"> |
|||
<uses-sdk /> |
|||
<application android:label="Avalonia.Skia.Android.TestApp" android:icon="@drawable/Icon"></application> |
|||
</manifest> |
|||
@ -1,30 +0,0 @@ |
|||
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("Avalonia.Skia.Android.TestApp")] |
|||
[assembly: AssemblyDescription("")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("")] |
|||
[assembly: AssemblyProduct("Avalonia.Skia.Android.TestApp")] |
|||
[assembly: AssemblyCopyright("Copyright © 2015")] |
|||
[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")] |
|||
@ -1,114 +0,0 @@ |
|||
#pragma warning disable 1591
|
|||
//------------------------------------------------------------------------------
|
|||
// <auto-generated>
|
|||
// This code was generated by a tool.
|
|||
// Runtime Version:4.0.30319.42000
|
|||
//
|
|||
// Changes to this file may cause incorrect behavior and will be lost if
|
|||
// the code is regenerated.
|
|||
// </auto-generated>
|
|||
//------------------------------------------------------------------------------
|
|||
|
|||
[assembly: global::Android.Runtime.ResourceDesignerAttribute("Avalonia.Skia.Android.TestApp.Resource", IsApplication=true)] |
|||
|
|||
namespace Avalonia.Skia.Android.TestApp |
|||
{ |
|||
|
|||
|
|||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] |
|||
public partial class Resource |
|||
{ |
|||
|
|||
static Resource() |
|||
{ |
|||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
|||
} |
|||
|
|||
public static void UpdateIdValues() |
|||
{ |
|||
global::Avalonia.Android.Resource.String.ApplicationName = global::Avalonia.Skia.Android.TestApp.Resource.String.ApplicationName; |
|||
global::Avalonia.Android.Resource.String.Hello = global::Avalonia.Skia.Android.TestApp.Resource.String.Hello; |
|||
} |
|||
|
|||
public partial class Attribute |
|||
{ |
|||
|
|||
static Attribute() |
|||
{ |
|||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
|||
} |
|||
|
|||
private Attribute() |
|||
{ |
|||
} |
|||
} |
|||
|
|||
public partial class Drawable |
|||
{ |
|||
|
|||
// aapt resource value: 0x7f020000
|
|||
public const int Icon = 2130837504; |
|||
|
|||
static Drawable() |
|||
{ |
|||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
|||
} |
|||
|
|||
private Drawable() |
|||
{ |
|||
} |
|||
} |
|||
|
|||
public partial class Id |
|||
{ |
|||
|
|||
// aapt resource value: 0x7f050000
|
|||
public const int MyButton = 2131034112; |
|||
|
|||
static Id() |
|||
{ |
|||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
|||
} |
|||
|
|||
private Id() |
|||
{ |
|||
} |
|||
} |
|||
|
|||
public partial class Layout |
|||
{ |
|||
|
|||
// aapt resource value: 0x7f030000
|
|||
public const int Main = 2130903040; |
|||
|
|||
static Layout() |
|||
{ |
|||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
|||
} |
|||
|
|||
private Layout() |
|||
{ |
|||
} |
|||
} |
|||
|
|||
public partial class String |
|||
{ |
|||
|
|||
// aapt resource value: 0x7f040001
|
|||
public const int ApplicationName = 2130968577; |
|||
|
|||
// aapt resource value: 0x7f040000
|
|||
public const int Hello = 2130968576; |
|||
|
|||
static String() |
|||
{ |
|||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
|||
} |
|||
|
|||
private String() |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
} |
|||
#pragma warning restore 1591
|
|||
|
Before Width: | Height: | Size: 4.0 KiB |
@ -1,13 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|||
android:orientation="vertical" |
|||
android:layout_width="fill_parent" |
|||
android:layout_height="fill_parent" |
|||
> |
|||
<Button |
|||
android:id="@+id/MyButton" |
|||
android:layout_width="fill_parent" |
|||
android:layout_height="wrap_content" |
|||
android:text="@string/Hello" |
|||
/> |
|||
</LinearLayout> |
|||
@ -1,5 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<resources> |
|||
<string name="Hello">Hello World, Click Me!</string> |
|||
<string name="ApplicationName">Avalonia.Skia.Android.TestApp</string> |
|||
</resources> |
|||
@ -1,24 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
|
|||
using Android.App; |
|||
using Android.Content; |
|||
using Android.OS; |
|||
using Android.Runtime; |
|||
using Android.Views; |
|||
using Android.Widget; |
|||
using Avalonia.Media; |
|||
using Avalonia.Platform; |
|||
|
|||
namespace Avalonia.Skia |
|||
{ |
|||
/// <summary>
|
|||
/// We will likely need platform specific pieces to support HW acceleration
|
|||
/// so leaving this class here for now as placeholder.
|
|||
/// </summary>
|
|||
internal partial class RenderTarget : IRenderTarget |
|||
{ |
|||
} |
|||
} |
|||
@ -1,85 +0,0 @@ |
|||
using System; |
|||
using Avalonia.Media; |
|||
using Avalonia.Platform; |
|||
using SkiaSharp; |
|||
using Android.Graphics; |
|||
using Android.Runtime; |
|||
using Android.Views; |
|||
using Avalonia.Skia.Android; |
|||
|
|||
namespace Avalonia.Skia |
|||
{ |
|||
internal partial class RenderTarget : IRenderTarget |
|||
{ |
|||
public SKSurface Surface { get; protected set; } |
|||
|
|||
public virtual DrawingContext CreateDrawingContext() |
|||
{ |
|||
return |
|||
new DrawingContext( |
|||
new DrawingContextImpl(Surface.Canvas)); |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
// Nothing to do here.
|
|||
} |
|||
} |
|||
|
|||
internal class WindowRenderTarget : RenderTarget |
|||
{ |
|||
private readonly SurfaceView _surfaceView; |
|||
private IntPtr _window; |
|||
|
|||
public WindowRenderTarget(SurfaceView surfaceView) |
|||
{ |
|||
_surfaceView = surfaceView; |
|||
} |
|||
|
|||
private void PrepareForDraw() |
|||
{ |
|||
int width = _surfaceView.Width; |
|||
var height = _surfaceView.Height; |
|||
|
|||
_window = NativeMethods.ANativeWindow_fromSurface(JNIEnv.Handle, _surfaceView.Holder.Surface.Handle); |
|||
var buffer = new NativeMethods.ANativeWindow_Buffer(); |
|||
var rc = new NativeMethods.ARect() {right = width, bottom = height}; |
|||
NativeMethods.ANativeWindow_lock(_window, out buffer, ref rc); |
|||
|
|||
var colorType = buffer.format == NativeMethods.AndroidPixelFormat.WINDOW_FORMAT_RGB_565 |
|||
? SKColorType.Rgb565 : SKImageInfo.PlatformColorType; |
|||
|
|||
var stride = buffer.stride * (colorType == SKColorType.Rgb565 ? 2 : 4); |
|||
|
|||
Surface = SKSurface.Create(buffer.width, buffer.height, colorType, |
|||
SKAlphaType.Premul, buffer.bits, stride); |
|||
|
|||
if (Surface == null) |
|||
throw new Exception("Unable to create Skia surface"); |
|||
} |
|||
|
|||
public override DrawingContext CreateDrawingContext() |
|||
{ |
|||
PrepareForDraw(); |
|||
|
|||
var canvas = Surface.Canvas; |
|||
canvas.RestoreToCount(0); |
|||
canvas.Save(); |
|||
canvas.Clear(SKColors.Red); |
|||
canvas.ResetMatrix(); |
|||
|
|||
return |
|||
new DrawingContext( |
|||
new WindowDrawingContextImpl(this)); |
|||
} |
|||
|
|||
public void Present() |
|||
{ |
|||
Surface?.Dispose(); |
|||
Surface = null; |
|||
NativeMethods.ANativeWindow_unlockAndPost(_window); |
|||
NativeMethods.ANativeWindow_release(_window); |
|||
_window = IntPtr.Zero; |
|||
} |
|||
} |
|||
} |
|||
@ -1,39 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
|
|||
using Android.App; |
|||
using Android.Content; |
|||
using Android.OS; |
|||
using Android.Runtime; |
|||
using Android.Views; |
|||
using Android.Widget; |
|||
using Avalonia.Media; |
|||
using Avalonia.Platform; |
|||
|
|||
namespace Avalonia.Skia.Android |
|||
{ |
|||
public abstract class SkiaRenderView : SkiaView |
|||
{ |
|||
private IRenderTarget _renderTarget; |
|||
|
|||
public SkiaRenderView(Activity context) : base(context) |
|||
{ |
|||
_renderTarget = |
|||
AvaloniaLocator.Current.GetService<IPlatformRenderInterface>() |
|||
.CreateRenderTarget(new object[]{this}); |
|||
} |
|||
|
|||
protected override void Draw() |
|||
{ |
|||
if (_renderTarget == null) |
|||
return; |
|||
using (var ctx = _renderTarget.CreateDrawingContext()) |
|||
OnRender(ctx); |
|||
} |
|||
|
|||
protected abstract void OnRender(DrawingContext ctx); |
|||
|
|||
} |
|||
} |
|||
Loading…
Reference in new issue