Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vision] Update to Xcode 9 Beta 5 #2458

Merged
merged 2 commits into from
Aug 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions src/Vision/VNFaceLandmarkRegion2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,45 @@
#if XAMCORE_2_0

using System;
using Vector2 = global::OpenTK.Vector2;
using XamCore.CoreGraphics;

namespace XamCore.Vision {
public partial class VNFaceLandmarkRegion2D {

public Vector2 this [nuint index] {
get { return GetPoint (index); }
}

public virtual Vector2 [] Points {
public virtual CGPoint [] NormalizedPoints {
get {
var ret = _GetPoints ();
var ret = _GetNormalizedPoints ();
if (ret == IntPtr.Zero)
return null;

unsafe {
var count = (int) PointCount;
var rv = new Vector2 [count];
var ptr = (Vector2*) ret;
var rv = new CGPoint [count];
var ptr = (CGPoint*) ret;
for (int i = 0; i < count; i++)
rv [i] = *ptr++;
return rv;
}
}
}

public virtual CGPoint [] GetPointsInImage (CGSize imageSize)
{
// return the address of the array of pointCount points
// or NULL if the conversion could not take place.
var ret = _GetPointsInImage (imageSize);
if (ret == IntPtr.Zero)
return null;

unsafe {
var count = (int) PointCount;
var rv = new CGPoint [count];
var ptr = (CGPoint*) ret;
for (int i = 0; i < count; i++)
rv [i] = *ptr++;
return rv;
}
}
}
}
#endif
173 changes: 134 additions & 39 deletions src/vision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,25 @@ enum VNBarcodeSymbology {
[Field ("VNBarcodeSymbologyAztec")]
Aztec,

[Field ("VNBarcodeSymbologyCODE39")]
[Field ("VNBarcodeSymbologyCode39")]
Code39,

[Field ("VNBarcodeSymbologyCODE39Checksum")]
[Field ("VNBarcodeSymbologyCode39Checksum")]
Code39Checksum,

[Field ("VNBarcodeSymbologyCODE39FullASCII")]
[Field ("VNBarcodeSymbologyCode39FullASCII")]
Code39FullAscii,

[Field ("VNBarcodeSymbologyCODE39FullASCIIChecksum")]
[Field ("VNBarcodeSymbologyCode39FullASCIIChecksum")]
Code39FullAsciiChecksum,

[Field ("VNBarcodeSymbologyCODE93")]
[Field ("VNBarcodeSymbologyCode93")]
Code93,

[Field ("VNBarcodeSymbologyCODE93i")]
[Field ("VNBarcodeSymbologyCode93i")]
Code93i,

[Field ("VNBarcodeSymbologyCODE128")]
[Field ("VNBarcodeSymbologyCode128")]
Code128,

[Field ("VNBarcodeSymbologyDataMatrix")]
Expand All @@ -97,10 +97,10 @@ enum VNBarcodeSymbology {
[Field ("VNBarcodeSymbologyEAN13")]
Ean13,

[Field ("VNBarcodeSymbologyI2OF5")]
[Field ("VNBarcodeSymbologyI2of5")]
I2OF5,

[Field ("VNBarcodeSymbologyI2OF5Checksum")]
[Field ("VNBarcodeSymbologyI2of5Checksum")]
I2OF5Checksum,

[Field ("VNBarcodeSymbologyITF14")]
Expand Down Expand Up @@ -264,12 +264,12 @@ interface VNFaceLandmarkRegion {
interface VNFaceLandmarkRegion2D {

[Internal]
[Export ("points")]
IntPtr _GetPoints ();
[Export ("normalizedPoints")]
IntPtr _GetNormalizedPoints ();

[Export ("pointAtIndex:")]
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
Vector2 GetPoint (nuint index);
[Internal]
[Export ("pointsInImageOfSize:")]
IntPtr _GetPointsInImage (CGSize imageSize);
}

[TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
Expand Down Expand Up @@ -586,6 +586,9 @@ interface VNBarcodeObservation {
[Static]
[Export ("observationWithBoundingBox:")]
VNBarcodeObservation FromBoundingBox (CGRect boundingBox);

[NullAllowed, Export ("payloadStringValue")]
string PayloadStringValue { get; }
}

[TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
Expand Down Expand Up @@ -655,6 +658,9 @@ interface VNRequest : NSCopying {

[NullAllowed, Export ("completionHandler", ArgumentSemantic.Copy)]
VNRequestCompletionHandler CompletionHandler { get; }

[Export ("usesCPUOnly")]
bool UsesCpuOnly { get; set; }
}

[TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
Expand All @@ -680,6 +686,9 @@ interface VNImageOptionKeys {

[Field ("VNImageOptionCameraIntrinsics")]
NSString CameraIntrinsicsKey { get; }

[Field ("VNImageOptionCIContext")]
NSString CIContextKey { get; }
}

[TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
Expand All @@ -692,6 +701,7 @@ interface VNImageOptions {
CoreGraphics.CGImageProperties Properties { get; set; }

NSData CameraIntrinsics { get; set; }
CIContext CIContext { get; set; }
}

[TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
Expand Down Expand Up @@ -804,40 +814,125 @@ interface VNSequenceRequestHandler {
[DisableDefaultCtor]
interface VNTargetedImageRequest {

[Export ("initWithTargetedCVPixelBuffer:")]
IntPtr Constructor (CVPixelBuffer pixelBuffer);
[Export ("initWithTargetedCVPixelBuffer:options:")]
IntPtr Constructor (CVPixelBuffer pixelBuffer, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless it's confusing use the same parameters name as Apple, i.e. the Dict suffix is not needed, options is fine.


[Export ("initWithTargetedCVPixelBuffer:completionHandler:")]
[DesignatedInitializer]
IntPtr Constructor (CVPixelBuffer pixelBuffer, [NullAllowed] VNRequestCompletionHandler completionHandler);
[Wrap ("this (pixelBuffer, options?.Dictionary)")]
IntPtr Constructor (CVPixelBuffer pixelBuffer, VNImageOptions options);

[Export ("initWithTargetedCGImage:")]
IntPtr Constructor (CGImage image);
[Export ("initWithTargetedCVPixelBuffer:options:completionHandler:")]
IntPtr Constructor (CVPixelBuffer pixelBuffer, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Export ("initWithTargetedCGImage:completionHandler:")]
[DesignatedInitializer]
IntPtr Constructor (CGImage image, [NullAllowed] VNRequestCompletionHandler completionHandler);
[Wrap ("this (pixelBuffer, options?.Dictionary, completionHandler)")]
IntPtr Constructor (CVPixelBuffer pixelBuffer, VNImageOptions options, VNRequestCompletionHandler completionHandler);

[Export ("initWithTargetedCIImage:")]
IntPtr Constructor (CIImage image);
[Export ("initWithTargetedCVPixelBuffer:orientation:options:")]
IntPtr Constructor (CVPixelBuffer pixelBuffer, CGImagePropertyOrientation orientation, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Export ("initWithTargetedCIImage:completionHandler:")]
[DesignatedInitializer]
IntPtr Constructor (CIImage image, [NullAllowed] VNRequestCompletionHandler completionHandler);
[Wrap ("this (pixelBuffer, orientation, options?.Dictionary)")]
IntPtr Constructor (CVPixelBuffer pixelBuffer, CGImagePropertyOrientation orientation, VNImageOptions options);

[Export ("initWithTargetedImageURL:")]
IntPtr Constructor (NSUrl imageUrl);
[Export ("initWithTargetedCVPixelBuffer:orientation:options:completionHandler:")]
IntPtr Constructor (CVPixelBuffer pixelBuffer, CGImagePropertyOrientation orientation, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Export ("initWithTargetedImageURL:completionHandler:")]
[DesignatedInitializer]
IntPtr Constructor (NSUrl imageUrl, [NullAllowed] VNRequestCompletionHandler completionHandler);
[Wrap ("this (pixelBuffer, orientation, options?.Dictionary, completionHandler)")]
IntPtr Constructor (CVPixelBuffer pixelBuffer, CGImagePropertyOrientation orientation, VNImageOptions options, VNRequestCompletionHandler completionHandler);

[Export ("initWithTargetedImageData:")]
IntPtr Constructor (NSData imageData);
[Export ("initWithTargetedCGImage:options:")]
IntPtr Constructor (CGImage cgImage, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Export ("initWithTargetedImageData:completionHandler:")]
[DesignatedInitializer]
IntPtr Constructor (NSData imageData, [NullAllowed] VNRequestCompletionHandler completionHandler);
[Wrap ("this (cgImage, options?.Dictionary)")]
IntPtr Constructor (CGImage cgImage, VNImageOptions options);

[Export ("initWithTargetedCGImage:options:completionHandler:")]
IntPtr Constructor (CGImage cgImage, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (cgImage, options?.Dictionary, completionHandler)")]
IntPtr Constructor (CGImage cgImage, VNImageOptions options, VNRequestCompletionHandler completionHandler);

[Export ("initWithTargetedCGImage:orientation:options:")]
IntPtr Constructor (CGImage cgImage, CGImagePropertyOrientation orientation, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (cgImage, orientation, options?.Dictionary)")]
IntPtr Constructor (CGImage cgImage, CGImagePropertyOrientation orientation, VNImageOptions options);

[Export ("initWithTargetedCGImage:orientation:options:completionHandler:")]
IntPtr Constructor (CGImage cgImage, CGImagePropertyOrientation orientation, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (cgImage, orientation, options?.Dictionary, completionHandler)")]
IntPtr Constructor (CGImage cgImage, CGImagePropertyOrientation orientation, VNImageOptions options, VNRequestCompletionHandler completionHandler);

[Export ("initWithTargetedCIImage:options:")]
IntPtr Constructor (CIImage ciImage, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (ciImage, options?.Dictionary)")]
IntPtr Constructor (CIImage ciImage, VNImageOptions options);

[Export ("initWithTargetedCIImage:options:completionHandler:")]
IntPtr Constructor (CIImage ciImage, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (ciImage, options?.Dictionary, completionHandler)")]
IntPtr Constructor (CIImage ciImage, VNImageOptions options, VNRequestCompletionHandler completionHandler);

[Export ("initWithTargetedCIImage:orientation:options:")]
IntPtr Constructor (CIImage ciImage, CGImagePropertyOrientation orientation, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (ciImage, orientation, options?.Dictionary)")]
IntPtr Constructor (CIImage ciImage, CGImagePropertyOrientation orientation, VNImageOptions options);

[Export ("initWithTargetedCIImage:orientation:options:completionHandler:")]
IntPtr Constructor (CIImage ciImage, CGImagePropertyOrientation orientation, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (ciImage, orientation, options?.Dictionary, completionHandler)")]
IntPtr Constructor (CIImage ciImage, CGImagePropertyOrientation orientation, VNImageOptions options, VNRequestCompletionHandler completionHandler);

[Export ("initWithTargetedImageURL:options:")]
IntPtr Constructor (NSUrl imageUrl, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (imageUrl, options?.Dictionary)")]
IntPtr Constructor (NSUrl imageUrl, VNImageOptions options);

[Export ("initWithTargetedImageURL:options:completionHandler:")]
IntPtr Constructor (NSUrl imageUrl, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (imageUrl, options?.Dictionary, completionHandler)")]
IntPtr Constructor (NSUrl imageUrl, VNImageOptions options, VNRequestCompletionHandler completionHandler);

[Export ("initWithTargetedImageURL:orientation:options:")]
IntPtr Constructor (NSUrl imageUrl, CGImagePropertyOrientation orientation, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (imageUrl, orientation, options?.Dictionary)")]
IntPtr Constructor (NSUrl imageUrl, CGImagePropertyOrientation orientation, VNImageOptions options);

[Export ("initWithTargetedImageURL:orientation:options:completionHandler:")]
IntPtr Constructor (NSUrl imageUrl, CGImagePropertyOrientation orientation, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (imageUrl, orientation, options?.Dictionary, completionHandler)")]
IntPtr Constructor (NSUrl imageUrl, CGImagePropertyOrientation orientation, VNImageOptions options, VNRequestCompletionHandler completionHandler);

[Export ("initWithTargetedImageData:options:")]
IntPtr Constructor (NSData imageData, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (imageData, options?.Dictionary)")]
IntPtr Constructor (NSData imageData, VNImageOptions options);

[Export ("initWithTargetedImageData:options:completionHandler:")]
IntPtr Constructor (NSData imageData, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (imageData, options?.Dictionary, completionHandler)")]
IntPtr Constructor (NSData imageData, VNImageOptions options, VNRequestCompletionHandler completionHandler);

[Export ("initWithTargetedImageData:orientation:options:")]
IntPtr Constructor (NSData imageData, CGImagePropertyOrientation orientation, NSDictionary optionsDict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (imageData, orientation, options?.Dictionary)")]
IntPtr Constructor (NSData imageData, CGImagePropertyOrientation orientation, VNImageOptions options);

[Export ("initWithTargetedImageData:orientation:options:completionHandler:")]
IntPtr Constructor (NSData imageData, CGImagePropertyOrientation orientation, NSDictionary optionsDict, [NullAllowed] VNRequestCompletionHandler completionHandler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Wrap ("this (imageData, orientation, options?.Dictionary, completionHandler)")]
IntPtr Constructor (NSData imageData, CGImagePropertyOrientation orientation, VNImageOptions options, VNRequestCompletionHandler completionHandler);
}

[TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
Expand Down
4 changes: 4 additions & 0 deletions tests/introspection/ApiCtorInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ protected virtual bool Match (ConstructorInfo ctor, Type type)
#endif
return true;
break;
case "VNTargetedImageRequest": // Explicitly disabled
if (ctor.ToString () == "Void .ctor(VNRequestCompletionHandler)")
return true;
break;
}

var ep = ctor.GetParameters ();
Expand Down