Renamed SKView to SKCanvasView for consistency
This commit is contained in:
Родитель
6434eb0ae5
Коммит
c3c48888c1
|
@ -3,20 +3,20 @@ using Android.Content;
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.Android;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Forms.SKView;
|
||||
using SKNativeView = SkiaSharp.Views.SKView;
|
||||
using SKFormsView = SkiaSharp.Views.Forms.SKCanvasView;
|
||||
using SKNativeView = SkiaSharp.Views.SKCanvasView;
|
||||
|
||||
[assembly: ExportRenderer(typeof(SKFormsView), typeof(SkiaSharp.Views.Forms.SKViewRenderer))]
|
||||
[assembly: ExportRenderer(typeof(SKFormsView), typeof(SkiaSharp.Views.Forms.SKCanvasViewRenderer))]
|
||||
|
||||
namespace SkiaSharp.Views.Forms
|
||||
{
|
||||
internal class SKViewRenderer : ViewRenderer<SKFormsView, SKNativeView>
|
||||
internal class SKCanvasViewRenderer : ViewRenderer<SKFormsView, SKNativeView>
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<SKFormsView> e)
|
||||
{
|
||||
if (e.OldElement != null)
|
||||
{
|
||||
var oldController = (ISKViewController)e.OldElement;
|
||||
var oldController = (ISKCanvasViewController)e.OldElement;
|
||||
|
||||
// unsubscribe from events
|
||||
oldController.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
|
@ -24,7 +24,7 @@ namespace SkiaSharp.Views.Forms
|
|||
|
||||
if (e.NewElement != null)
|
||||
{
|
||||
var newController = (ISKViewController)e.NewElement;
|
||||
var newController = (ISKCanvasViewController)e.NewElement;
|
||||
|
||||
// create the native view
|
||||
var view = new InternalView(Context, newController);
|
||||
|
@ -43,7 +43,7 @@ namespace SkiaSharp.Views.Forms
|
|||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
// detach all events before disposing
|
||||
var controller = (ISKViewController)Element;
|
||||
var controller = (ISKCanvasViewController)Element;
|
||||
if (controller != null)
|
||||
{
|
||||
controller.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
|
@ -60,9 +60,9 @@ namespace SkiaSharp.Views.Forms
|
|||
|
||||
private class InternalView : SKNativeView
|
||||
{
|
||||
private readonly ISKViewController controller;
|
||||
private readonly ISKCanvasViewController controller;
|
||||
|
||||
public InternalView(Context context, ISKViewController controller)
|
||||
public InternalView(Context context, ISKCanvasViewController controller)
|
||||
: base(context)
|
||||
{
|
||||
this.controller = controller;
|
|
@ -89,7 +89,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="SKViewRenderer.cs" />
|
||||
<Compile Include="SKCanvasViewRenderer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
|
@ -3,8 +3,8 @@ using Xamarin.Forms;
|
|||
|
||||
namespace SkiaSharp.Views.Forms
|
||||
{
|
||||
[RenderWith(typeof(SKViewRenderer))]
|
||||
public class SKView : View, ISKViewController
|
||||
[RenderWith(typeof(SKCanvasViewRenderer))]
|
||||
public class SKCanvasView : View, ISKCanvasViewController
|
||||
{
|
||||
// the user can subscribe to repaint
|
||||
public event EventHandler<SKPaintSurfaceEventArgs> PaintSurface;
|
||||
|
@ -27,19 +27,19 @@ namespace SkiaSharp.Views.Forms
|
|||
|
||||
// ISKViewController implementation
|
||||
|
||||
event EventHandler ISKViewController.SurfaceInvalidated
|
||||
event EventHandler ISKCanvasViewController.SurfaceInvalidated
|
||||
{
|
||||
add { SurfaceInvalidated += value; }
|
||||
remove { SurfaceInvalidated -= value; }
|
||||
}
|
||||
|
||||
void ISKViewController.OnPaintSurface(SKPaintSurfaceEventArgs e)
|
||||
void ISKCanvasViewController.OnPaintSurface(SKPaintSurfaceEventArgs e)
|
||||
{
|
||||
OnPaintSurface(e);
|
||||
}
|
||||
}
|
||||
|
||||
internal interface ISKViewController : IViewController
|
||||
internal interface ISKCanvasViewController : IViewController
|
||||
{
|
||||
// the native listens to this event
|
||||
event EventHandler SurfaceInvalidated;
|
|
@ -12,6 +12,6 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)SkiaSharpViewsFormsAssemblyInfo.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)SKPaintGLSurfaceEventArgs.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)SKPaintSurfaceEventArgs.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)SKView.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)SKCanvasView.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -2,20 +2,20 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.UWP;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Forms.SKView;
|
||||
using SKFormsView = SkiaSharp.Views.Forms.SKCanvasView;
|
||||
using SKNativeView = SkiaSharp.Views.SKXamlCanvas;
|
||||
|
||||
[assembly: ExportRenderer(typeof(SKFormsView), typeof(SkiaSharp.Views.Forms.SKViewRenderer))]
|
||||
[assembly: ExportRenderer(typeof(SKFormsView), typeof(SkiaSharp.Views.Forms.SKCanvasViewRenderer))]
|
||||
|
||||
namespace SkiaSharp.Views.Forms
|
||||
{
|
||||
internal class SKViewRenderer : ViewRenderer<SKFormsView, SKNativeView>
|
||||
internal class SKCanvasViewRenderer : ViewRenderer<SKFormsView, SKNativeView>
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<SKFormsView> e)
|
||||
{
|
||||
if (e.OldElement != null)
|
||||
{
|
||||
var oldController = (ISKViewController)e.OldElement;
|
||||
var oldController = (ISKCanvasViewController)e.OldElement;
|
||||
|
||||
// unsubscribe from events
|
||||
oldController.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
|
@ -23,7 +23,7 @@ namespace SkiaSharp.Views.Forms
|
|||
|
||||
if (e.NewElement != null)
|
||||
{
|
||||
var newController = (ISKViewController)e.NewElement;
|
||||
var newController = (ISKCanvasViewController)e.NewElement;
|
||||
|
||||
// create the native view
|
||||
var view = new InternalView(newController);
|
||||
|
@ -42,7 +42,7 @@ namespace SkiaSharp.Views.Forms
|
|||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
// detach all events before disposing
|
||||
var controller = (ISKViewController)Element;
|
||||
var controller = (ISKCanvasViewController)Element;
|
||||
if (controller != null)
|
||||
{
|
||||
controller.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
|
@ -59,9 +59,9 @@ namespace SkiaSharp.Views.Forms
|
|||
|
||||
private class InternalView : SKNativeView
|
||||
{
|
||||
private readonly ISKViewController controller;
|
||||
private readonly ISKCanvasViewController controller;
|
||||
|
||||
public InternalView(ISKViewController controller)
|
||||
public InternalView(ISKCanvasViewController controller)
|
||||
{
|
||||
this.controller = controller;
|
||||
}
|
|
@ -107,7 +107,7 @@
|
|||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SKViewRenderer.cs" />
|
||||
<Compile Include="SKCanvasViewRenderer.cs" />
|
||||
<EmbeddedResource Include="Properties\SkiaSharp.Views.Forms.UWP.rd.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\SkiaSharp.Views.Forms.Shared\SkiaSharp.Views.Forms.Shared.projitems" Label="Shared" />
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Forms.SKView;
|
||||
using SKNativeView = SkiaSharp.Views.SKView;
|
||||
using SKFormsView = SkiaSharp.Views.Forms.SKCanvasView;
|
||||
using SKNativeView = SkiaSharp.Views.SKCanvasView;
|
||||
|
||||
[assembly: ExportRenderer(typeof(SKFormsView), typeof(SkiaSharp.Views.Forms.SKViewRenderer))]
|
||||
[assembly: ExportRenderer(typeof(SKFormsView), typeof(SkiaSharp.Views.Forms.SKCanvasViewRenderer))]
|
||||
|
||||
namespace SkiaSharp.Views.Forms
|
||||
{
|
||||
internal class SKViewRenderer : ViewRenderer<SKFormsView, SKNativeView>
|
||||
internal class SKCanvasViewRenderer : ViewRenderer<SKFormsView, SKNativeView>
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<SKFormsView> e)
|
||||
{
|
||||
if (e.OldElement != null)
|
||||
{
|
||||
var oldController = (ISKViewController)e.OldElement;
|
||||
var oldController = (ISKCanvasViewController)e.OldElement;
|
||||
|
||||
// unsubscribe from events
|
||||
oldController.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
|
@ -23,7 +23,7 @@ namespace SkiaSharp.Views.Forms
|
|||
|
||||
if (e.NewElement != null)
|
||||
{
|
||||
var newController = (ISKViewController)e.NewElement;
|
||||
var newController = (ISKCanvasViewController)e.NewElement;
|
||||
|
||||
// create the native view
|
||||
var view = new InternalView(newController);
|
||||
|
@ -42,7 +42,7 @@ namespace SkiaSharp.Views.Forms
|
|||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
// detach all events before disposing
|
||||
var controller = (ISKViewController)Element;
|
||||
var controller = (ISKCanvasViewController)Element;
|
||||
if (controller != null)
|
||||
{
|
||||
controller.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
|
@ -59,18 +59,18 @@ namespace SkiaSharp.Views.Forms
|
|||
|
||||
private class InternalView : SKNativeView
|
||||
{
|
||||
private readonly ISKViewController controller;
|
||||
private readonly ISKCanvasViewController controller;
|
||||
|
||||
public InternalView(ISKViewController controller)
|
||||
public InternalView(ISKCanvasViewController controller)
|
||||
{
|
||||
UserInteractionEnabled = false;
|
||||
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
public override void Draw(SKSurface surface, SKImageInfo info)
|
||||
public override void DrawInSurface(SKSurface surface, SKImageInfo info)
|
||||
{
|
||||
base.Draw(surface, info);
|
||||
base.DrawInSurface(surface, info);
|
||||
|
||||
// the control is being repainted, let the user know
|
||||
controller.OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
|
@ -20,21 +20,28 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink></MtouchLink>
|
||||
<MtouchHttpClientHandler></MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider></MtouchTlsProvider>
|
||||
<MtouchLink>
|
||||
</MtouchLink>
|
||||
<MtouchHttpClientHandler>
|
||||
</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>
|
||||
</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink></MtouchLink>
|
||||
<MtouchHttpClientHandler></MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider></MtouchTlsProvider>
|
||||
<MtouchLink>
|
||||
</MtouchLink>
|
||||
<MtouchHttpClientHandler>
|
||||
</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>
|
||||
</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
@ -65,7 +72,7 @@
|
|||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SKViewRenderer.cs" />
|
||||
<Compile Include="SKCanvasViewRenderer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace SkiaSharp.Views.Forms
|
||||
{
|
||||
internal class SKViewRenderer
|
||||
internal class SKCanvasViewRenderer
|
||||
{
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SKViewRenderer.cs" />
|
||||
<Compile Include="SKCanvasViewRenderer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="SkiaSharp">
|
||||
|
|
Загрузка…
Ссылка в новой задаче