27 changed files with 205 additions and 945 deletions
@ -1,23 +0,0 @@ |
|||||
using System; |
|
||||
using System.Runtime.InteropServices; |
|
||||
using ObjCRuntime; |
|
||||
|
|
||||
/* No longer needed with SkiaSharp |
|
||||
|
|
||||
[assembly: LinkWith("Perspex.Skia.iOS.libperspesk_standalone.a", ForceLoad = true, SmartLink = true, IsCxx = true, Frameworks = "ImageIO MobileCoreServices CoreText")] |
|
||||
|
|
||||
namespace Perspex.Skia |
|
||||
{ |
|
||||
class MethodTableImpl : MethodTable |
|
||||
{ |
|
||||
[DllImport("__Internal")] |
|
||||
static extern IntPtr GetPerspexMethodTable(); |
|
||||
|
|
||||
public MethodTableImpl() : base(GetPerspexMethodTable()) |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
*/ |
|
||||
@ -1,240 +0,0 @@ |
|||||
using System; |
|
||||
using System.Linq; |
|
||||
using System.Runtime.InteropServices; |
|
||||
using Perspex.Media; |
|
||||
|
|
||||
// ReSharper disable InconsistentNaming
|
|
||||
|
|
||||
namespace Perspex.Skia |
|
||||
{ |
|
||||
/* No longer needed with SkiaSharp |
|
||||
|
|
||||
unsafe abstract class MethodTable |
|
||||
{ |
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate IntPtr _CreateWindowRenderTarget(IntPtr nativeHandle); |
|
||||
|
|
||||
public _CreateWindowRenderTarget CreateWindowRenderTarget; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate IntPtr _RenderTargetCreateRenderingContext(IntPtr target); |
|
||||
|
|
||||
public _RenderTargetCreateRenderingContext RenderTargetCreateRenderingContext; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DisposeRenderTarget(IntPtr target); |
|
||||
|
|
||||
public _DisposeRenderTarget DisposeRenderTarget; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DisposeRenderingContext(IntPtr ctx); |
|
||||
|
|
||||
public _DisposeRenderingContext DisposeRenderingContext; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DrawRectangle(IntPtr ctx, void* brush, ref SkRect rect, float borderRadius); |
|
||||
|
|
||||
public _DrawRectangle DrawRectangle; |
|
||||
|
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _PushClip(IntPtr ctx, ref SkRect rect); |
|
||||
|
|
||||
public _PushClip PushClip; |
|
||||
|
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _PopClip(IntPtr ctx); |
|
||||
|
|
||||
public _PopClip PopClip; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _SetTransform(IntPtr ctx, void* matrix6); |
|
||||
|
|
||||
public _SetTransform SetTransformNative; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DrawLine(IntPtr ctx, void* brush, float x1, float y1, float x2, float y2); |
|
||||
|
|
||||
public _DrawLine DrawLine; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate IntPtr _CreatePath(SkiaGeometryElement[] elements, int count, out SkRect bounds); |
|
||||
|
|
||||
public _CreatePath CreatePath; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DisposePath(IntPtr handle); |
|
||||
|
|
||||
public _DisposePath DisposePath; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate IntPtr _TransformPath(IntPtr path, void* matrix6); |
|
||||
|
|
||||
public _TransformPath TransformPathNative; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DrawGeometry(IntPtr ctx, IntPtr path, void* fill, void* stroke, bool useEvenOdd); |
|
||||
|
|
||||
public _DrawGeometry DrawGeometry; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DestroySkData(IntPtr handle); |
|
||||
|
|
||||
public _DestroySkData DestroySkData; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate bool _LoadImage(byte[] data, int len, out IntPtr image, out int width, out int height); |
|
||||
|
|
||||
public _LoadImage LoadImage; |
|
||||
|
|
||||
public enum SkiaImageType |
|
||||
{ |
|
||||
Png,Gif,Jpeg |
|
||||
} |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate IntPtr _SaveImage(IntPtr image, SkiaImageType type, int quality); |
|
||||
|
|
||||
public _SaveImage SaveImage; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DrawImage(IntPtr ctx, IntPtr image, float opacity, ref SkRect srcRect, ref SkRect destRect); |
|
||||
|
|
||||
public _DrawImage DrawImage; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate IntPtr _CreateRenderTargetBitmap(int width, int height); |
|
||||
|
|
||||
public _CreateRenderTargetBitmap CreateRenderTargetBitmap; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DisposeImage(IntPtr image); |
|
||||
|
|
||||
public _DisposeImage DisposeImage; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate int _GetSkDataSize(IntPtr data); |
|
||||
|
|
||||
public _GetSkDataSize GetSkDataSize; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _ReadSkData(IntPtr data, byte[] buffer, int count); |
|
||||
|
|
||||
public _ReadSkData ReadSkData; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate NativeDrawingContextSettings* _GetDrawingContextSettingsPtr(IntPtr ctx); |
|
||||
|
|
||||
public _GetDrawingContextSettingsPtr GetDrawingContextSettingsPtr; |
|
||||
|
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate IntPtr _CreateTypeface(void* name, int style); |
|
||||
|
|
||||
public _CreateTypeface CreateTypeface; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate IntPtr _CreateFormattedText(void*utf16, int len, IntPtr typeface, float fontSize, TextAlignment align, NativeFormattedText** shared); |
|
||||
|
|
||||
public _CreateFormattedText CreateFormattedText; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _RebuildFormattedText(IntPtr handle); |
|
||||
|
|
||||
public _RebuildFormattedText RebuildFormattedText; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DestroyFormattedText(IntPtr handle); |
|
||||
|
|
||||
public _DestroyFormattedText DestroyFormattedText; |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _DrawFormattedText(IntPtr ctx, void* brush, IntPtr text, float x, float y); |
|
||||
|
|
||||
public _DrawFormattedText DrawFormattedText; |
|
||||
|
|
||||
public enum Option |
|
||||
{ |
|
||||
ForceSoftware = 0 |
|
||||
} |
|
||||
|
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
||||
public delegate void _SetOption(Option option, IntPtr value); |
|
||||
|
|
||||
public _SetOption SetOption; |
|
||||
|
|
||||
private static readonly Type[] TableOrder = new Type[] |
|
||||
{ |
|
||||
typeof (_CreateWindowRenderTarget), |
|
||||
typeof (_DisposeRenderTarget), |
|
||||
typeof (_RenderTargetCreateRenderingContext), |
|
||||
typeof (_DisposeRenderingContext), |
|
||||
typeof (_DrawRectangle), |
|
||||
typeof (_PushClip), |
|
||||
typeof (_PopClip), |
|
||||
typeof (_SetTransform), |
|
||||
typeof (_DrawLine), |
|
||||
typeof (_CreatePath), |
|
||||
typeof (_DisposePath), |
|
||||
typeof (_DrawGeometry), |
|
||||
typeof (_GetSkDataSize), |
|
||||
typeof (_ReadSkData), |
|
||||
typeof (_DestroySkData), |
|
||||
typeof (_LoadImage), |
|
||||
typeof (_SaveImage), |
|
||||
typeof (_DrawImage), |
|
||||
typeof (_CreateRenderTargetBitmap), |
|
||||
typeof (_DisposeImage), |
|
||||
typeof (_GetDrawingContextSettingsPtr), |
|
||||
typeof (_CreateTypeface), |
|
||||
typeof (_CreateFormattedText), |
|
||||
typeof (_RebuildFormattedText), |
|
||||
typeof (_DestroyFormattedText), |
|
||||
typeof (_DrawFormattedText), |
|
||||
typeof (_SetOption), |
|
||||
typeof (_TransformPath) |
|
||||
}; |
|
||||
|
|
||||
void ConvertMatrix(Matrix value, float* target) |
|
||||
{ |
|
||||
target[0] = (float)value.M11; |
|
||||
target[1] = (float)value.M21; |
|
||||
target[2] = (float)value.M31; |
|
||||
|
|
||||
target[3] = (float)value.M12; |
|
||||
target[4] = (float)value.M22; |
|
||||
target[5] = (float)value.M32; |
|
||||
} |
|
||||
|
|
||||
public unsafe IntPtr TransformPath(IntPtr path, Matrix matrix) |
|
||||
{ |
|
||||
var tmp = stackalloc float[6]; |
|
||||
ConvertMatrix(matrix, tmp); |
|
||||
return TransformPathNative(path, tmp); |
|
||||
} |
|
||||
|
|
||||
public unsafe void SetTransform(IntPtr ctx, Matrix matrix) |
|
||||
{ |
|
||||
var tmp = stackalloc float[6]; |
|
||||
ConvertMatrix(matrix, tmp); |
|
||||
SetTransformNative(ctx, tmp); |
|
||||
} |
|
||||
|
|
||||
protected MethodTable(IntPtr methodTable) |
|
||||
{ |
|
||||
var dic = typeof (MethodTable).GetFields().ToDictionary(f => f.FieldType, f => f); |
|
||||
|
|
||||
for (var c = 0; c < TableOrder.Length; c++) |
|
||||
{ |
|
||||
IntPtr pMethod = Marshal.ReadIntPtr(methodTable, IntPtr.Size*c); |
|
||||
var t = TableOrder[c]; |
|
||||
dic[t].SetValue(this, Marshal.GetDelegateForFunctionPointer(pMethod, t)); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public static readonly MethodTable Instance = new MethodTableImpl(); |
|
||||
} |
|
||||
|
|
||||
*/ |
|
||||
} |
|
||||
@ -1,115 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Runtime.InteropServices; |
|
||||
using System.Text; |
|
||||
using Perspex.Media; |
|
||||
|
|
||||
namespace Perspex.Skia |
|
||||
{ |
|
||||
/* No longer needed with SkiaSharp |
|
||||
internal enum NativeBrushType |
|
||||
{ |
|
||||
Solid, |
|
||||
LinearGradient, |
|
||||
RadialGradient, |
|
||||
Image |
|
||||
} |
|
||||
|
|
||||
[StructLayout(LayoutKind.Sequential)] |
|
||||
internal unsafe struct NativeBrush |
|
||||
{ |
|
||||
public const int MaxGradientStops = 1024; |
|
||||
public const int MaxDashCount = 1024; |
|
||||
public NativeBrushType Type; |
|
||||
public double Opacity; |
|
||||
public uint Color; |
|
||||
|
|
||||
//Strokes
|
|
||||
public bool Stroke; |
|
||||
public float StrokeThickness; |
|
||||
public PenLineJoin StrokeLineJoin; |
|
||||
public float StrokeMiterLimit; |
|
||||
public int StrokeDashCount; |
|
||||
public float StrokeDashOffset; |
|
||||
public PenLineCap StrokeLineCap; |
|
||||
|
|
||||
|
|
||||
//Gradients
|
|
||||
public int GradientStopCount; |
|
||||
public GradientSpreadMethod GradientSpreadMethod; |
|
||||
public SkiaPoint GradientStartPoint, GradientEndPoint; |
|
||||
public float GradientRadius; |
|
||||
|
|
||||
//Image Brush
|
|
||||
public IntPtr Bitmap; |
|
||||
public TileMode BitmapTileMode; |
|
||||
public SkiaPoint BitmapTranslation; |
|
||||
|
|
||||
//Blobs
|
|
||||
public fixed uint GradientStopColors [MaxGradientStops]; |
|
||||
public fixed float GradientStops [MaxGradientStops]; |
|
||||
public fixed float StrokeDashes [MaxDashCount]; |
|
||||
|
|
||||
public void Reset() |
|
||||
{ |
|
||||
Type = NativeBrushType.Solid; |
|
||||
Opacity = 1f; |
|
||||
Color = 0; |
|
||||
Stroke = false; |
|
||||
StrokeThickness = 1; |
|
||||
GradientStopCount = 0; |
|
||||
StrokeDashCount = 0; |
|
||||
StrokeLineCap = PenLineCap.Flat; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
unsafe class NativeBrushContainer : IDisposable |
|
||||
{ |
|
||||
private readonly NativeBrushPool _pool; |
|
||||
public NativeBrush* Brush; |
|
||||
|
|
||||
readonly List<IDisposable> _disposables = new List<IDisposable>(); |
|
||||
|
|
||||
public NativeBrushContainer(NativeBrushPool pool) |
|
||||
{ |
|
||||
_pool = pool; |
|
||||
Brush = (NativeBrush*) Marshal.AllocHGlobal(Marshal.SizeOf(typeof (NativeBrush))).ToPointer(); |
|
||||
Brush->Reset(); |
|
||||
} |
|
||||
|
|
||||
public void AddDisposable(IDisposable disp) |
|
||||
{ |
|
||||
_disposables.Add(disp); |
|
||||
} |
|
||||
|
|
||||
public void Dispose() |
|
||||
{ |
|
||||
foreach (var disp in _disposables) |
|
||||
disp.Dispose(); |
|
||||
_disposables.Clear(); |
|
||||
Brush->Reset(); |
|
||||
_pool?.Return(this); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
class NativeBrushPool |
|
||||
{ |
|
||||
public static NativeBrushPool Instance { get; } = new NativeBrushPool(); |
|
||||
readonly Stack<NativeBrushContainer> _pool = new Stack<NativeBrushContainer>(); |
|
||||
|
|
||||
public void Return(NativeBrushContainer c) |
|
||||
{ |
|
||||
_pool.Push(c); |
|
||||
} |
|
||||
|
|
||||
public NativeBrushContainer Get() |
|
||||
{ |
|
||||
if (_pool.Count == 0) |
|
||||
return new NativeBrushContainer(this); |
|
||||
return _pool.Pop(); |
|
||||
} |
|
||||
} |
|
||||
*/ |
|
||||
} |
|
||||
@ -1,12 +0,0 @@ |
|||||
using System.Runtime.InteropServices; |
|
||||
|
|
||||
/* No longer needed with SkiaSharp |
|
||||
namespace Perspex.Skia |
|
||||
{ |
|
||||
[StructLayout(LayoutKind.Sequential)] |
|
||||
struct NativeDrawingContextSettings |
|
||||
{ |
|
||||
public double Opacity; |
|
||||
} |
|
||||
} |
|
||||
*/ |
|
||||
@ -1,27 +0,0 @@ |
|||||
using System.Runtime.InteropServices; |
|
||||
|
|
||||
/* No longer needed with SkiaSharp |
|
||||
|
|
||||
namespace Perspex.Skia |
|
||||
{ |
|
||||
[StructLayout(LayoutKind.Sequential)] |
|
||||
unsafe struct NativeFormattedText |
|
||||
{ |
|
||||
public float WidthConstraint; |
|
||||
public int LineCount; |
|
||||
public NativeFormattedTextLine* Lines; |
|
||||
public SkRect* Bounds; |
|
||||
}; |
|
||||
|
|
||||
[StructLayout(LayoutKind.Sequential)] |
|
||||
unsafe struct NativeFormattedTextLine |
|
||||
{ |
|
||||
public float Top; |
|
||||
public int Start; |
|
||||
public int Length; |
|
||||
public float Height; |
|
||||
public float Width; |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
*/ |
|
||||
@ -1,110 +0,0 @@ |
|||||
using System; |
|
||||
|
|
||||
/* No longer needed with SkiaSharp |
|
||||
|
|
||||
namespace Perspex.Skia |
|
||||
{ |
|
||||
abstract class PerspexHandleHolder : IDisposable |
|
||||
{ |
|
||||
private readonly IntPtr _handle; |
|
||||
|
|
||||
public IntPtr Handle |
|
||||
{ |
|
||||
get |
|
||||
{ |
|
||||
CheckDisposed(); |
|
||||
return _handle; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public bool IsDisposed { get; private set; } |
|
||||
|
|
||||
public void CheckDisposed() |
|
||||
{ |
|
||||
if (IsDisposed) |
|
||||
throw new ObjectDisposedException(GetType().FullName); |
|
||||
} |
|
||||
|
|
||||
protected PerspexHandleHolder(IntPtr handle) |
|
||||
{ |
|
||||
_handle = handle; |
|
||||
} |
|
||||
|
|
||||
protected abstract void Delete(IntPtr handle); |
|
||||
|
|
||||
public void Dispose() |
|
||||
{ |
|
||||
if(IsDisposed) |
|
||||
return; |
|
||||
IsDisposed = true; |
|
||||
Delete(_handle); |
|
||||
GC.SuppressFinalize(this); |
|
||||
} |
|
||||
|
|
||||
~PerspexHandleHolder() |
|
||||
{ |
|
||||
Dispose(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
class RefCountable<T> : IDisposable where T : PerspexHandleHolder |
|
||||
{ |
|
||||
class Shared |
|
||||
{ |
|
||||
public readonly T Target; |
|
||||
private int _refCount = 1; |
|
||||
|
|
||||
public Shared(T target) |
|
||||
{ |
|
||||
Target = target; |
|
||||
} |
|
||||
|
|
||||
public void AddRef() => _refCount++; |
|
||||
public void Release() |
|
||||
{ |
|
||||
_refCount--; |
|
||||
if (_refCount <= 0) |
|
||||
Target.Dispose(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public bool IsDisposed => _shared == null; |
|
||||
private Shared _shared; |
|
||||
public void CheckDisposed() |
|
||||
{ |
|
||||
if (IsDisposed) |
|
||||
throw new ObjectDisposedException(GetType().FullName); |
|
||||
} |
|
||||
|
|
||||
public IntPtr Handle |
|
||||
{ |
|
||||
get |
|
||||
{ |
|
||||
CheckDisposed(); |
|
||||
return _shared.Target.Handle; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public RefCountable(T handle) |
|
||||
{ |
|
||||
_shared = new Shared(handle); |
|
||||
} |
|
||||
|
|
||||
public RefCountable(RefCountable<T> other) |
|
||||
{ |
|
||||
other._shared.Target.CheckDisposed(); |
|
||||
other._shared.AddRef(); |
|
||||
_shared = other._shared; |
|
||||
} |
|
||||
|
|
||||
public RefCountable<T> Clone() => new RefCountable<T>(this); |
|
||||
|
|
||||
public void Dispose() |
|
||||
{ |
|
||||
_shared?.Release(); |
|
||||
_shared = null; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
*/ |
|
||||
@ -1,31 +0,0 @@ |
|||||
using SkiaSharp; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Runtime.InteropServices; |
|
||||
using System.Text; |
|
||||
|
|
||||
/* No longer needed with SkiaSharp |
|
||||
|
|
||||
namespace Perspex.Skia |
|
||||
{ |
|
||||
[StructLayout(LayoutKind.Sequential)] |
|
||||
struct SkRect |
|
||||
{ |
|
||||
public float Left, Top, Right, Bottom; |
|
||||
|
|
||||
public static SkRect FromRect(Rect rc) |
|
||||
{ |
|
||||
return new SkRect() |
|
||||
{ |
|
||||
Left = (float) rc.X, |
|
||||
Top = (float) rc.Y, |
|
||||
Right = (float) rc.Right, |
|
||||
Bottom = (float) rc.Bottom |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
public Rect ToRect() => new Rect(Left, Top, Right - Left, Bottom - Top); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
*/ |
|
||||
@ -1,33 +0,0 @@ |
|||||
using System.Runtime.InteropServices; |
|
||||
|
|
||||
/* No longer needed with SkiaSharp |
|
||||
|
|
||||
namespace Perspex.Skia |
|
||||
{ |
|
||||
[StructLayout(LayoutKind.Sequential)] |
|
||||
struct SkiaPoint |
|
||||
{ |
|
||||
public float X, Y; |
|
||||
|
|
||||
public SkiaPoint(float x, float y) |
|
||||
{ |
|
||||
X = x; |
|
||||
Y = y; |
|
||||
} |
|
||||
|
|
||||
public SkiaPoint(double x, double y) |
|
||||
{ |
|
||||
X = (float)x; |
|
||||
Y = (float)y; |
|
||||
} |
|
||||
|
|
||||
public SkiaPoint(Point p) : this(p.X, p.Y) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public static implicit operator SkiaPoint(Point pt) => new SkiaPoint(pt); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
*/ |
|
||||
@ -0,0 +1,21 @@ |
|||||
|
|
||||
|
namespace Perspex.Skia |
||||
|
{ |
||||
|
// not sure we need this yet
|
||||
|
internal class WindowDrawingContextImpl : DrawingContextImpl |
||||
|
{ |
||||
|
WindowRenderTarget _target; |
||||
|
|
||||
|
public WindowDrawingContextImpl(WindowRenderTarget target) |
||||
|
: base(target.Surface.Canvas) |
||||
|
{ |
||||
|
_target = target; |
||||
|
} |
||||
|
|
||||
|
public override void Dispose() |
||||
|
{ |
||||
|
base.Dispose(); |
||||
|
_target.Present(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,77 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Text; |
|
||||
using Perspex.Controls.Platform; |
|
||||
using Perspex.Input; |
|
||||
using Perspex.Input.Platform; |
|
||||
using Perspex.Platform; |
|
||||
using Perspex.Shared.PlatformSupport; |
|
||||
using Perspex.Skia; |
|
||||
using UIKit; |
|
||||
|
|
||||
/* No Longer needed |
|
||||
namespace Perspex.iOS |
|
||||
{ |
|
||||
public class PerspexAppDelegate : UIApplicationDelegate |
|
||||
{ |
|
||||
static bool _initialized = false; |
|
||||
internal static MouseDevice MouseDevice; |
|
||||
internal static KeyboardDevice KeyboardDevice; |
|
||||
|
|
||||
protected void InitPerspex(Type appType) |
|
||||
{ |
|
||||
if(_initialized) |
|
||||
return; |
|
||||
_initialized = true; |
|
||||
|
|
||||
var window = new UIWindow(UIScreen.MainScreen.Bounds); |
|
||||
var controller = new PerspexViewController(window); |
|
||||
window.RootViewController = controller; |
|
||||
window.MakeKeyAndVisible(); |
|
||||
|
|
||||
Application.RegisterPlatformCallback(() => |
|
||||
{ |
|
||||
MouseDevice = new MouseDevice(); |
|
||||
KeyboardDevice = new KeyboardDevice(); |
|
||||
SharedPlatform.Register(appType.Assembly); |
|
||||
PerspexLocator.CurrentMutable |
|
||||
.Bind<IClipboard>().ToTransient<Clipboard>() |
|
||||
//.Bind<ISystemDialogImpl>().ToTransient<SystemDialogImpl>()
|
|
||||
.Bind<IStandardCursorFactory>().ToTransient<CursorFactory>() |
|
||||
.Bind<IKeyboardDevice>().ToConstant(KeyboardDevice) |
|
||||
.Bind<IMouseDevice>().ToConstant(MouseDevice) |
|
||||
.Bind<IPlatformSettings>().ToSingleton<PlatformSettings>() |
|
||||
.Bind<IPlatformThreadingInterface>().ToConstant(PlatformThreadingInterface.Instance) |
|
||||
.Bind<IWindowingPlatform>().ToConstant(new WindowingPlatform(controller.PerspexView)); |
|
||||
SkiaPlatform.Initialize(); |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
class WindowingPlatform : IWindowingPlatform |
|
||||
{ |
|
||||
private readonly IWindowImpl _window; |
|
||||
|
|
||||
public WindowingPlatform(IWindowImpl window) |
|
||||
{ |
|
||||
_window = window; |
|
||||
} |
|
||||
|
|
||||
public IWindowImpl CreateWindow() |
|
||||
{ |
|
||||
return _window; |
|
||||
} |
|
||||
|
|
||||
public IWindowImpl CreateEmbeddableWindow() |
|
||||
{ |
|
||||
throw new NotImplementedException(); |
|
||||
} |
|
||||
|
|
||||
public IPopupImpl CreatePopup() |
|
||||
{ |
|
||||
throw new NotImplementedException(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
*/ |
|
||||
@ -0,0 +1,33 @@ |
|||||
|
using Perspex.Platform; |
||||
|
using System; |
||||
|
|
||||
|
namespace Perspex.iOS |
||||
|
{ |
||||
|
// This is somewhat generic, could probably put this elsewhere. But I don't think
|
||||
|
// it should part of the iOS App Delegate
|
||||
|
//
|
||||
|
class WindowingPlatformImpl : IWindowingPlatform |
||||
|
{ |
||||
|
private readonly IWindowImpl _window; |
||||
|
|
||||
|
public WindowingPlatformImpl(IWindowImpl window) |
||||
|
{ |
||||
|
_window = window; |
||||
|
} |
||||
|
|
||||
|
public IWindowImpl CreateWindow() |
||||
|
{ |
||||
|
return _window; |
||||
|
} |
||||
|
|
||||
|
public IWindowImpl CreateEmbeddableWindow() |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public IPopupImpl CreatePopup() |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue