[xcode12][pencilkit] Update for beta 1 (add macOS support, new apis for iOS) (#8982)

* PencilKit changes for xcode12
This commit is contained in:
Whitney Schmidt 2020-07-10 14:30:57 -04:00 коммит произвёл GitHub
Родитель 41e204f81f
Коммит 32c82f3f95
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 229 добавлений и 130 удалений

Просмотреть файл

@ -1273,6 +1273,10 @@ PASSKIT_API_SOURCES = \
PASSKIT_SOURCES = \
PassKit/PKPaymentRequest.cs \
# PencilKit
PENCILKIT_API_SOURCEs = \
PencilKit/Indexers.cs
# PdfKit
PDFKIT_API_SOURCES = \

Просмотреть файл

@ -3,8 +3,9 @@
//
// Authors:
// TJ Lambert <t-anlamb@microsoft.com>
// Whitney Schmidt <whschm@microsoft.com>
//
// Copyright 2019 Microsoft Corporation All rights reserved.
// Copyright 2019, 2020 Microsoft Corporation All rights reserved.
//
#if MONOMAC
@ -19,25 +20,30 @@ using UIResponder = Foundation.NSObject;
using UIView = Foundation.NSObject;
using UIWindow = Foundation.NSObject;
using UIUserInterfaceStyle = Foundation.NSObject;
using BezierPath = AppKit.NSBezierPath;
#else
using UIKit;
using BezierPath = UIKit.UIBezierPath;
#endif
using System;
using System.ComponentModel;
using ObjCRuntime;
using Foundation;
using CoreGraphics;
namespace PencilKit {
[iOS (13, 0), NoMac]
[iOS (13, 0), Mac (10, 16)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[Native]
enum PKEraserType : long {
Vector,
Bitmap,
}
[iOS (13, 0), NoMac]
[iOS (13, 0), Mac (10, 16)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
enum PKInkType {
[Field ("PKInkTypePen")]
Pen,
@ -49,8 +55,18 @@ namespace PencilKit {
Marker,
}
[Unavailable (PlatformName.UIKitForMac), Advice ("This API is not available when using UIKit on macOS.")]
[iOS (14, 0), NoMac]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[Native]
enum PKCanvasViewDrawingPolicy : ulong
{
Default,
AnyInput,
PencilOnly,
}
[iOS (13, 0), NoMac]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[BaseType (typeof (NSObject))]
[Model (AutoGeneratedName = true)] [Protocol]
interface PKCanvasViewDelegate : UIScrollViewDelegate {
@ -71,6 +87,7 @@ namespace PencilKit {
interface IPKCanvasViewDelegate {}
[iOS (13, 0), NoMac]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[BaseType (typeof (UIScrollView))]
interface PKCanvasView : PKToolPickerObserver {
@ -78,31 +95,38 @@ namespace PencilKit {
// [Export ("delegate", ArgumentSemantic.Weak), NullAllowed]
// NSObject WeakDelegate { get; set; }
[Unavailable (PlatformName.UIKitForMac), Advice ("This API is not available when using UIKit on macOS.")]
[Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using Catalyst on macOS.")]
[Wrap ("WeakDelegate"), NullAllowed, New]
IPKCanvasViewDelegate Delegate { get; set; }
[Export ("drawing", ArgumentSemantic.Copy)]
PKDrawing Drawing { get; set; }
[Unavailable (PlatformName.UIKitForMac), Advice ("This API is not available when using UIKit on macOS.")]
[Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using Catalyst on macOS.")]
[Export ("tool", ArgumentSemantic.Copy)]
PKTool Tool { get; set; }
[Unavailable (PlatformName.UIKitForMac), Advice ("This API is not available when using UIKit on macOS.")]
[Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using Catalyst on macOS.")]
[Export ("rulerActive")]
bool RulerActive { [Bind ("isRulerActive")] get; set; }
[Unavailable (PlatformName.UIKitForMac), Advice ("This API is not available when using UIKit on macOS.")]
[Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using Catalyst on macOS.")]
[Export ("drawingGestureRecognizer")]
UIGestureRecognizer DrawingGestureRecognizer { get; }
[Unavailable (PlatformName.UIKitForMac), Advice ("This API is not available when using UIKit on macOS.")]
[Deprecated (PlatformName.iOS, 14, 0, message: "Use 'DrawingPolicy' property instead.")]
[Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using Catalyst on macOS.")]
[Export ("allowsFingerDrawing")]
bool AllowsFingerDrawing { get; set; }
[iOS (14, 0)]
[Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using Catalyst on macOS.")]
[Export ("drawingPolicy", ArgumentSemantic.Assign)]
PKCanvasViewDrawingPolicy DrawingPolicy { get; set; }
}
[iOS (13, 0), Mac (10, 15)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[BaseType (typeof (NSObject))]
[DesignatedDefaultCtor]
interface PKDrawing : NSCopying, NSSecureCoding {
@ -114,12 +138,20 @@ namespace PencilKit {
[Export ("initWithData:error:")]
IntPtr Constructor (NSData data, [NullAllowed] out NSError error);
[Mac (10, 16), iOS (14, 0)]
[Export ("initWithStrokes:")]
IntPtr Constructor (PKStroke[] strokes);
[Export ("dataRepresentation")]
NSData DataRepresentation { get; }
[Export ("bounds")]
CGRect Bounds { get; }
[Mac (10, 16), iOS (14, 0)]
[Export ("strokes")]
PKStroke[] Strokes { get; }
[Export ("imageFromRect:scale:")]
UIImage GetImage (CGRect rect, nfloat scale);
@ -128,9 +160,14 @@ namespace PencilKit {
[Export ("drawingByAppendingDrawing:")]
PKDrawing GetDrawing (PKDrawing drawing);
[Mac (10, 16), iOS (14, 0)]
[Export ("drawingByAppendingStrokes:")]
PKDrawing GetDrawing (PKStroke[] strokes);
}
[iOS (13, 0), NoMac]
[iOS (13, 0), Mac (10, 16)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[BaseType (typeof (PKTool))]
[DisableDefaultCtor]
interface PKEraserTool {
@ -143,7 +180,8 @@ namespace PencilKit {
IntPtr Constructor (PKEraserType eraserType);
}
[iOS (13, 0), NoMac]
[iOS (13, 0), Mac (10, 16)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[BaseType (typeof (PKTool))]
[DisableDefaultCtor]
interface PKInkingTool {
@ -155,6 +193,10 @@ namespace PencilKit {
[Export ("initWithInkType:color:")]
IntPtr Constructor ([BindAs (typeof (PKInkType))] NSString type, UIColor color);
[iOS (14, 0)]
[Export ("initWithInk:width:")]
IntPtr Constructor (PKInk ink, nfloat width);
[Static]
[Export ("defaultWidthForInkType:")]
nfloat GetDefaultWidth ([BindAs (typeof (PKInkType))] NSString inkType);
@ -180,22 +222,28 @@ namespace PencilKit {
[Export ("width")]
nfloat Width { get; }
[iOS (14, 0)]
[Export ("ink")]
PKInk Ink { get; }
}
[iOS (13, 0), NoMac]
[iOS (13, 0), Mac (10, 16)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[BaseType (typeof (PKTool))]
[DesignatedDefaultCtor]
interface PKLassoTool {}
[iOS (13, 0), NoMac]
[iOS (13, 0), Mac (10, 16)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface PKTool : NSCopying {}
interface IPKToolPickerObserver {}
[Unavailable (PlatformName.UIKitForMac), Advice ("This API is not available when using UIKit on macOS.")]
[iOS (13, 0), NoMac]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[Protocol]
interface PKToolPickerObserver {
@ -212,13 +260,16 @@ namespace PencilKit {
void FramesObscuredDidChange (PKToolPicker toolPicker);
}
[Unavailable (PlatformName.UIKitForMac), Advice ("This API is not available when using UIKit on macOS.")]
[iOS (13, 0), NoMac]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[DisableDefaultCtor]
[BaseType (typeof (NSObject))]
interface PKToolPicker {
[iOS (14, 0)]
[Export ("init")]
IntPtr Constructor ();
[Export ("addObserver:")]
void AddObserver (IPKToolPickerObserver observer);
@ -246,9 +297,167 @@ namespace PencilKit {
[Export ("colorUserInterfaceStyle", ArgumentSemantic.Assign)]
UIUserInterfaceStyle ColorUserInterfaceStyle { get; set; }
[Deprecated (PlatformName.iOS, 14, 0, message: "Create individual instances instead.")]
[Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using Catalyst on macOS.")]
[Static]
[return: NullAllowed]
[Export ("sharedToolPickerForWindow:")]
PKToolPicker GetSharedToolPicker (UIWindow window);
[iOS (14, 0)]
[Export ("showsDrawingPolicyControls")]
bool ShowsDrawingPolicyControls { get; set; }
[iOS (14, 0)]
[NullAllowed]
[Export ("stateAutosaveName")]
string StateAutosaveName { get; set; }
}
[Mac (10, 16), iOS (14, 0)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[DisableDefaultCtor]
[BaseType (typeof(NSObject))]
interface PKInk : NSCopying
{
[EditorBrowsable (EditorBrowsableState.Advanced)]
[Export ("initWithInkType:color:")]
[DesignatedInitializer]
IntPtr Constructor (/* enum PKInkType */ NSString type, UIColor color);
[Wrap ("this (type.GetConstant ()!, color)")]
IntPtr Constructor (PKInkType type, UIColor color);
[EditorBrowsable (EditorBrowsableState.Advanced)]
[Export ("inkType")]
NSString WeakInkType { get; }
[Wrap ("PKInkTypeExtensions.GetValue(WeakInkType)")]
PKInkType InkType { get; }
[Export ("color")]
UIColor Color { get; }
}
[Mac (10, 16), iOS (14, 0)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[DisableDefaultCtor]
[BaseType (typeof(NSObject))]
interface PKFloatRange : NSCopying
{
[Export ("initWithLowerBound:upperBound:")]
IntPtr Constructor (nfloat lowerBound, nfloat upperBound);
[Export ("lowerBound")]
nfloat LowerBound { get; }
[Export ("upperBound")]
nfloat UpperBound { get; }
}
[Mac (10, 16), iOS (14, 0)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[DisableDefaultCtor]
[BaseType (typeof(NSObject))]
interface PKStroke : NSCopying
{
[Export ("initWithInk:strokePath:transform:mask:")]
IntPtr Constructor (PKInk ink, PKStrokePath path, CGAffineTransform transform, [NullAllowed] BezierPath mask);
[Export ("ink")]
PKInk Ink { get; }
[Export ("transform")]
CGAffineTransform Transform { get; }
[Export ("path")]
PKStrokePath Path { get; }
[NullAllowed, Export ("mask")]
BezierPath Mask { get; }
[Export ("renderBounds")]
CGRect RenderBounds { get; }
[Export ("maskedPathRanges")]
PKFloatRange[] MaskedPathRanges { get; }
}
delegate void PKInterpolatedPointsEnumeratorHandler (PKStrokePoint strokePoint, out bool stop);
[Mac (10, 16), iOS (14, 0)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[DisableDefaultCtor]
[BaseType (typeof(NSObject))]
interface PKStrokePath : NSCopying
{
[Export ("initWithControlPoints:creationDate:")]
[DesignatedInitializer]
IntPtr Constructor (PKStrokePoint[] controlPoints, NSDate creationDate);
[Export ("count")]
nuint Count { get; }
[Export ("creationDate")]
NSDate CreationDate { get; }
[Export ("pointAtIndex:")]
PKStrokePoint GetPoint (nuint index);
[Export ("objectAtIndexedSubscript:")]
PKStrokePoint GetObject (nuint indexedSubscript);
[Export ("interpolatedLocationAt:")]
CGPoint GetInterpolatedLocation (nfloat parametricValue);
[Export ("interpolatedPointAt:")]
PKStrokePoint GetInterpolatedPoint (nfloat parametricValue);
[Export ("enumerateInterpolatedPointsInRange:strideByDistance:usingBlock:")]
void EnumerateInterpolatedPointsByDistanceStep (PKFloatRange range, nfloat distanceStep, PKInterpolatedPointsEnumeratorHandler enumeratorHandler);
[Export ("enumerateInterpolatedPointsInRange:strideByTime:usingBlock:")]
void EnumerateInterpolatedPointsByTimeStep (PKFloatRange range, double timeStep, PKInterpolatedPointsEnumeratorHandler enumeratorHandler);
[Export ("enumerateInterpolatedPointsInRange:strideByParametricStep:usingBlock:")]
void EnumerateInterpolatedPointsByParametricStep (PKFloatRange range, nfloat parametricStep, PKInterpolatedPointsEnumeratorHandler enumeratorHandler);
[Export ("parametricValue:offsetByDistance:")]
nfloat GetParametricValue (nfloat parametricValue, nfloat distanceStep);
[Export ("parametricValue:offsetByTime:")]
nfloat GetParametricValue (nfloat parametricValue, double timeStep);
}
[Mac (10, 16), iOS (14, 0)]
[Introduced (PlatformName.MacCatalyst, 14, 0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface PKStrokePoint : NSCopying
{
[Export ("initWithLocation:timeOffset:size:opacity:force:azimuth:altitude:")]
[DesignatedInitializer]
IntPtr Constructor (CGPoint location, double timeOffset, CGSize size, nfloat opacity, nfloat force, nfloat azimuth, nfloat altitude);
[Export ("location")]
CGPoint Location { get; }
[Export ("timeOffset")]
double TimeOffset { get; }
[Export ("size")]
CGSize Size { get; }
[Export ("opacity")]
nfloat Opacity { get; }
[Export ("azimuth")]
nfloat Azimuth { get; }
[Export ("force")]
nfloat Force { get; }
[Export ("altitude")]
nfloat Altitude { get; }
}
}

Просмотреть файл

@ -1,52 +0,0 @@
!deprecated-attribute-missing! PKToolPicker::sharedToolPickerForWindow: missing a [Deprecated] attribute
!missing-enum! PKCanvasViewDrawingPolicy not bound
!missing-selector! PKCanvasView::drawingPolicy not bound
!missing-selector! PKCanvasView::setDrawingPolicy: not bound
!missing-selector! PKDrawing::drawingByAppendingStrokes: not bound
!missing-selector! PKDrawing::initWithStrokes: not bound
!missing-selector! PKDrawing::strokes not bound
!missing-selector! PKFloatRange::initWithLowerBound:upperBound: not bound
!missing-selector! PKFloatRange::lowerBound not bound
!missing-selector! PKFloatRange::upperBound not bound
!missing-selector! PKInk::color not bound
!missing-selector! PKInk::initWithInkType:color: not bound
!missing-selector! PKInk::inkType not bound
!missing-selector! PKInkingTool::initWithInk:width: not bound
!missing-selector! PKInkingTool::ink not bound
!missing-selector! PKStroke::initWithInk:strokePath:transform:mask: not bound
!missing-selector! PKStroke::ink not bound
!missing-selector! PKStroke::mask not bound
!missing-selector! PKStroke::maskedPathRanges not bound
!missing-selector! PKStroke::path not bound
!missing-selector! PKStroke::renderBounds not bound
!missing-selector! PKStroke::transform not bound
!missing-selector! PKStrokePath::count not bound
!missing-selector! PKStrokePath::creationDate not bound
!missing-selector! PKStrokePath::enumerateInterpolatedPointsInRange:strideByDistance:usingBlock: not bound
!missing-selector! PKStrokePath::enumerateInterpolatedPointsInRange:strideByParametricStep:usingBlock: not bound
!missing-selector! PKStrokePath::enumerateInterpolatedPointsInRange:strideByTime:usingBlock: not bound
!missing-selector! PKStrokePath::initWithControlPoints:creationDate: not bound
!missing-selector! PKStrokePath::interpolatedLocationAt: not bound
!missing-selector! PKStrokePath::interpolatedPointAt: not bound
!missing-selector! PKStrokePath::objectAtIndexedSubscript: not bound
!missing-selector! PKStrokePath::parametricValue:offsetByDistance: not bound
!missing-selector! PKStrokePath::parametricValue:offsetByTime: not bound
!missing-selector! PKStrokePath::pointAtIndex: not bound
!missing-selector! PKStrokePoint::altitude not bound
!missing-selector! PKStrokePoint::azimuth not bound
!missing-selector! PKStrokePoint::force not bound
!missing-selector! PKStrokePoint::initWithLocation:timeOffset:size:opacity:force:azimuth:altitude: not bound
!missing-selector! PKStrokePoint::location not bound
!missing-selector! PKStrokePoint::opacity not bound
!missing-selector! PKStrokePoint::size not bound
!missing-selector! PKStrokePoint::timeOffset not bound
!missing-selector! PKToolPicker::init not bound
!missing-selector! PKToolPicker::setShowsDrawingPolicyControls: not bound
!missing-selector! PKToolPicker::setStateAutosaveName: not bound
!missing-selector! PKToolPicker::showsDrawingPolicyControls not bound
!missing-selector! PKToolPicker::stateAutosaveName not bound
!missing-type! PKFloatRange not bound
!missing-type! PKInk not bound
!missing-type! PKStroke not bound
!missing-type! PKStrokePath not bound
!missing-type! PKStrokePoint not bound

Просмотреть файл

@ -1,62 +0,0 @@
!missing-enum! PKEraserType not bound
!missing-field! PKInkTypeMarker not bound
!missing-field! PKInkTypePen not bound
!missing-field! PKInkTypePencil not bound
!missing-selector! +PKInkingTool::defaultWidthForInkType: not bound
!missing-selector! +PKInkingTool::maximumWidthForInkType: not bound
!missing-selector! +PKInkingTool::minimumWidthForInkType: not bound
!missing-selector! PKDrawing::drawingByAppendingStrokes: not bound
!missing-selector! PKDrawing::initWithStrokes: not bound
!missing-selector! PKDrawing::strokes not bound
!missing-selector! PKEraserTool::eraserType not bound
!missing-selector! PKEraserTool::initWithEraserType: not bound
!missing-selector! PKFloatRange::initWithLowerBound:upperBound: not bound
!missing-selector! PKFloatRange::lowerBound not bound
!missing-selector! PKFloatRange::upperBound not bound
!missing-selector! PKInk::color not bound
!missing-selector! PKInk::initWithInkType:color: not bound
!missing-selector! PKInk::inkType not bound
!missing-selector! PKInkingTool::color not bound
!missing-selector! PKInkingTool::initWithInk:width: not bound
!missing-selector! PKInkingTool::initWithInkType:color: not bound
!missing-selector! PKInkingTool::initWithInkType:color:width: not bound
!missing-selector! PKInkingTool::ink not bound
!missing-selector! PKInkingTool::inkType not bound
!missing-selector! PKInkingTool::width not bound
!missing-selector! PKLassoTool::init not bound
!missing-selector! PKStroke::initWithInk:strokePath:transform:mask: not bound
!missing-selector! PKStroke::ink not bound
!missing-selector! PKStroke::mask not bound
!missing-selector! PKStroke::maskedPathRanges not bound
!missing-selector! PKStroke::path not bound
!missing-selector! PKStroke::renderBounds not bound
!missing-selector! PKStroke::transform not bound
!missing-selector! PKStrokePath::count not bound
!missing-selector! PKStrokePath::creationDate not bound
!missing-selector! PKStrokePath::enumerateInterpolatedPointsInRange:strideByDistance:usingBlock: not bound
!missing-selector! PKStrokePath::enumerateInterpolatedPointsInRange:strideByParametricStep:usingBlock: not bound
!missing-selector! PKStrokePath::enumerateInterpolatedPointsInRange:strideByTime:usingBlock: not bound
!missing-selector! PKStrokePath::initWithControlPoints:creationDate: not bound
!missing-selector! PKStrokePath::interpolatedLocationAt: not bound
!missing-selector! PKStrokePath::interpolatedPointAt: not bound
!missing-selector! PKStrokePath::objectAtIndexedSubscript: not bound
!missing-selector! PKStrokePath::parametricValue:offsetByDistance: not bound
!missing-selector! PKStrokePath::parametricValue:offsetByTime: not bound
!missing-selector! PKStrokePath::pointAtIndex: not bound
!missing-selector! PKStrokePoint::altitude not bound
!missing-selector! PKStrokePoint::azimuth not bound
!missing-selector! PKStrokePoint::force not bound
!missing-selector! PKStrokePoint::initWithLocation:timeOffset:size:opacity:force:azimuth:altitude: not bound
!missing-selector! PKStrokePoint::location not bound
!missing-selector! PKStrokePoint::opacity not bound
!missing-selector! PKStrokePoint::size not bound
!missing-selector! PKStrokePoint::timeOffset not bound
!missing-type! PKEraserTool not bound
!missing-type! PKFloatRange not bound
!missing-type! PKInk not bound
!missing-type! PKInkingTool not bound
!missing-type! PKLassoTool not bound
!missing-type! PKStroke not bound
!missing-type! PKStrokePath not bound
!missing-type! PKStrokePoint not bound
!missing-type! PKTool not bound