-
-
Save rolfbjarne/41bb92baf79a006d5ebf59457d5ce3aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace VisionExtensions { | |
using System.Runtime.InteropServices; | |
using CoreFoundation; | |
using ObjCRuntime; | |
using Vision; | |
public enum VNBarcodeCompositeType : long { | |
None = 0, | |
Linked, | |
Gs1TypeA, | |
Gs1TypeB, | |
Gs1TypeC, | |
} | |
public static class VNBarcodeObservation_Extensions { | |
public static bool GetIsGS1DataCarrier (this VNBarcodeObservation self) | |
{ | |
var sel = Selector.GetHandle ("isGS1DataCarrier"); | |
var rv = byte_objc_msgSend (self.GetHandle (), sel); | |
return rv != 0; | |
} | |
public static bool GetIsColorInverted (this VNBarcodeObservation self) | |
{ | |
var sel = Selector.GetHandle ("isColorInverted"); | |
var rv = byte_objc_msgSend (self.GetHandle (), sel); | |
return rv != 0; | |
} | |
public static VNBarcodeCompositeType GetSupplementalCompositeType (this VNBarcodeObservation self) | |
{ | |
var sel = Selector.GetHandle ("supplementalCompositeType"); | |
var rv = VNBarcodeCompositeType_objc_msgSend (self.GetHandle (), sel); | |
return rv; | |
} | |
public static string? GetSupplementalPayloadString (this VNBarcodeObservation self) | |
{ | |
var sel = Selector.GetHandle ("supplementalPayloadString"); | |
var rv = IntPtr_objc_msgSend (self.GetHandle (), sel); | |
return CFString.FromHandle (rv, false); | |
} | |
public static NSData? GetSupplementalPayloadData (this VNBarcodeObservation self) | |
{ | |
var sel = Selector.GetHandle ("supplementalPayloadData"); | |
var rv = IntPtr_objc_msgSend (self.GetHandle (), sel); | |
return Runtime.GetNSObject<NSData> (rv, false); | |
} | |
const string VisionLibrary = "/System/Library/Frameworks/Vision.framework/Vision"; | |
[DllImport (VisionLibrary)] | |
static extern IntPtr IntPtr_objc_msgSend (IntPtr handle, IntPtr selector); | |
[DllImport (VisionLibrary)] | |
static extern byte byte_objc_msgSend (IntPtr handle, IntPtr selector); | |
[DllImport (VisionLibrary)] | |
static extern VNBarcodeCompositeType VNBarcodeCompositeType_objc_msgSend (IntPtr handle, IntPtr selector); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment