Skip to content

Commit

Permalink
Merge pull request #12601 from rachelkang/xcode13.0-coreimage-b1-b3
Browse files Browse the repository at this point in the history
[CoreImage] Update Xcode 13.0 bindings betas 1 and 3
  • Loading branch information
rachelkang committed Sep 15, 2021
2 parents d873034 + f1e8f01 commit b9cde5e
Show file tree
Hide file tree
Showing 10 changed files with 286 additions and 371 deletions.
27 changes: 27 additions & 0 deletions src/CoreImage/CIFilter.cs
Expand Up @@ -185,6 +185,12 @@ internal void SetNInt (string key, nint value)
SetValueForKey (new NSNumber (value), nskey);
}

internal void SetNUInt (string key, nuint value)
{
using (var nskey = new NSString (key))
SetValueForKey (new NSNumber (value), nskey);
}

internal void SetBool (string key, bool value)
{
using (var nskey = new NSString (key))
Expand Down Expand Up @@ -236,6 +242,11 @@ internal nint GetNInt (string key)
return Get<NSNumber> (key)?.NIntValue ?? default (nint);
}

internal nuint GetNUInt (string key)
{
return Get<NSNumber> (key)?.NUIntValue ?? default (nuint);
}

internal bool GetBool (string key)
{
return Get<NSNumber> (key)?.BoolValue ?? default (bool);
Expand Down Expand Up @@ -461,6 +472,8 @@ internal static CIFilter FromName (string? filterName, IntPtr handle)
return new CIMaximumComponent (handle);
case "CIMinimumComponent":
return new CIMinimumComponent (handle);
case "CIPersonSegmentation":
return new CIPersonSegmentation (handle);
case "CIPerspectiveTile":
return new CIPerspectiveTile (handle);
case "CIPerspectiveTransform":
Expand Down Expand Up @@ -513,6 +526,16 @@ internal static CIFilter FromName (string? filterName, IntPtr handle)
return new CIConvolution9Horizontal (handle);
case "CIConvolution9Vertical":
return new CIConvolution9Vertical (handle);
case "CIConvolutionRGB3X3":
return new CIConvolutionRGB3X3 (handle);
case "CIConvolutionRGB5X5":
return new CIConvolutionRGB5X5 (handle);
case "CIConvolutionRGB7X7":
return new CIConvolutionRGB7X7 (handle);
case "CIConvolutionRGB9Horizontal":
return new CIConvolutionRGB9Horizontal (handle);
case "CIConvolutionRGB9Vertical":
return new CIConvolutionRGB9Vertical (handle);
case "CILinearToSRGBToneCurve":
return new CILinearToSRGBToneCurve (handle);
case "CIPerspectiveTransformWithExtent":
Expand Down Expand Up @@ -559,12 +582,16 @@ internal static CIFilter FromName (string? filterName, IntPtr handle)
return new CILinearBurnBlendMode (handle);
case "CILinearDodgeBlendMode":
return new CILinearDodgeBlendMode (handle);
case "CILinearLightBlendMode":
return new CILinearLightBlendMode (handle);
case "CIPerspectiveCorrection":
return new CIPerspectiveCorrection (handle);
case "CIPinLightBlendMode":
return new CIPinLightBlendMode (handle);
case "CISubtractBlendMode":
return new CISubtractBlendMode (handle);
case "CIVividLightBlendMode":
return new CIVividLightBlendMode (handle);
case "CIAccordionFoldTransition":
return new CIAccordionFoldTransition (handle);
case "CIAreaAverage":
Expand Down
243 changes: 238 additions & 5 deletions src/coreimage.cs
Expand Up @@ -441,6 +441,16 @@ interface CIContext_ImageRepresentation {
[return: NullAllowed]
NSData GetHeifRepresentation (CIImage image, CIFormat format, CGColorSpace colorSpace, CIImageRepresentationOptions options);

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0)]
[Export ("HEIF10RepresentationOfImage:colorSpace:options:error:")]
[return: NullAllowed]
NSData GetHeif10Representation (CIImage image, CGColorSpace colorSpace, NSDictionary options, [NullAllowed] out NSError error);

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0)]
[Wrap ("GetHeif10Representation (This, image, colorSpace, options.GetDictionary ()!, out error)")]
[return: NullAllowed]
NSData GetHeif10Representation (CIImage image, CGColorSpace colorSpace, CIImageRepresentationOptions options, [NullAllowed] out NSError error);

[iOS (11,0)][TV (11,0)][Mac (10,13)]
[Export ("PNGRepresentationOfImage:format:colorSpace:options:")]
[return: NullAllowed]
Expand Down Expand Up @@ -475,6 +485,14 @@ interface CIContext_ImageRepresentation {
[Wrap ("WriteHeifRepresentation (This, image, url, format, colorSpace, options.GetDictionary ()!, out error)")]
bool WriteHeifRepresentation (CIImage image, NSUrl url, CIFormat format, CGColorSpace colorSpace, CIImageRepresentationOptions options, [NullAllowed] out NSError error);

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0)]
[Export ("writeHEIF10RepresentationOfImage:toURL:colorSpace:options:error:")]
bool WriteHeif10Representation (CIImage image, NSUrl url, CGColorSpace colorSpace, NSDictionary options, [NullAllowed] out NSError error);

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0)]
[Wrap ("WriteHeif10Representation (This, image, url, colorSpace, options.GetDictionary ()!, out error)")]
bool WriteHeif10Representation (CIImage image, NSUrl url, CGColorSpace colorSpace, CIImageRepresentationOptions options, [NullAllowed] out NSError error);

[iOS (11,0)][TV (11,0)][Mac (10,13)]
[Export ("writePNGRepresentationOfImage:toURL:format:colorSpace:options:error:")]
bool WritePngRepresentation (CIImage image, NSUrl url, CIFormat format, CGColorSpace colorSpace, NSDictionary options, [NullAllowed] out NSError error);
Expand Down Expand Up @@ -629,43 +647,239 @@ interface CIFilter : NSSecureCoding, NSCopying {

// CIRAWFilter (CIFilter)

[Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[iOS (10,0)]
[TV (10,0)]
[Static]
[Export ("filterWithImageURL:options:")]
CIFilter CreateRawFilter (NSUrl url, NSDictionary options);

[Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[iOS (10,0)]
[TV (10,0)]
[Static]
[Wrap ("CreateRawFilter (url, options.GetDictionary ()!)")]
CIFilter CreateRawFilter (NSUrl url, CIRawFilterOptions options);

[Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[iOS (10,0)]
[TV (10,0)]
[Static]
[Export ("filterWithImageData:options:")]
CIFilter CreateRawFilter (NSData data, NSDictionary options);

[Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[iOS (10,0)]
[TV (10,0)]
[Static]
[Wrap ("CreateRawFilter (data, options.GetDictionary ()!)")]
CIFilter CreateRawFilter (NSData data, CIRawFilterOptions options);

[Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[iOS (10,0)][Mac (10,12)]
[TV (10,0)]
[Static]
[Export ("filterWithCVPixelBuffer:properties:options:")]
CIFilter CreateRawFilter (CVPixelBuffer pixelBuffer, NSDictionary properties, NSDictionary options);

[Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[iOS (10,0)][Mac (10,12)]
[TV (10,0)]
[Static]
[Wrap ("CreateRawFilter (pixelBuffer, properties, options.GetDictionary ()!)")]
CIFilter CreateRawFilter (CVPixelBuffer pixelBuffer, NSDictionary properties, CIRawFilterOptions options);
}

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0)]
public enum CIRawDecoderVersion : long {

[Field ("CIRAWDecoderVersionNone")]
VersionNone,

[Field ("CIRAWDecoderVersion8")]
Version8,

[Field ("CIRAWDecoderVersion8DNG")]
Version8Dng,

[Field ("CIRAWDecoderVersion7")]
Version7,

[Field ("CIRAWDecoderVersion7DNG")]
Version7Dng,

[Field ("CIRAWDecoderVersion6")]
Version6,

[Field ("CIRAWDecoderVersion6DNG")]
Version6Dng,
}

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0)]
[BaseType (typeof(CIFilter), Name="CIRAWFilter")]
interface CIRawFilter : CIFilterProtocol
{
[Static]
[Export ("supportedCameraModels")]
string[] SupportedCameraModels { get; }

[Export ("supportedDecoderVersions")]
string[] SupportedDecoderVersions { get; }

[Export ("nativeSize")]
CGSize NativeSize { get; }

[Export ("properties")]
NSDictionary Properties { get; }

[Export ("orientation", ArgumentSemantic.Assign)]
CGImagePropertyOrientation Orientation { get; set; }

[Export ("draftModeEnabled")]
bool DraftModeEnabled { [Bind ("isDraftModeEnabled")] get; set; }

[Export ("decoderVersion", ArgumentSemantic.Retain)]
string DecoderVersion { get; set; }

[Export ("scaleFactor")]
float ScaleFactor { get; set; }

[Export ("exposure")]
float Exposure { get; set; }

[Export ("baselineExposure")]
float BaselineExposure { get; set; }

[Export ("shadowBias")]
float ShadowBias { get; set; }

[Export ("boostAmount")]
float BoostAmount { get; set; }

[Export ("boostShadowAmount")]
float BoostShadowAmount { get; set; }

[Export ("gamutMappingEnabled")]
bool GamutMappingEnabled { [Bind ("isGamutMappingEnabled")] get; set; }

[Export ("lensCorrectionSupported")]
bool LensCorrectionSupported { [Bind ("isLensCorrectionSupported")] get; }

[Export ("lensCorrectionEnabled")]
bool LensCorrectionEnabled { [Bind ("isLensCorrectionEnabled")] get; set; }

[Export ("luminanceNoiseReductionSupported")]
bool LuminanceNoiseReductionSupported { [Bind ("isLuminanceNoiseReductionSupported")] get; }

[Export ("luminanceNoiseReductionAmount")]
float LuminanceNoiseReductionAmount { get; set; }

[Export ("colorNoiseReductionSupported")]
bool ColorNoiseReductionSupported { [Bind ("isColorNoiseReductionSupported")] get; }

[Export ("colorNoiseReductionAmount")]
float ColorNoiseReductionAmount { get; set; }

[Export ("sharpnessSupported")]
bool SharpnessSupported { [Bind ("isSharpnessSupported")] get; }

[Export ("sharpnessAmount")]
float SharpnessAmount { get; set; }

[Export ("contrastSupported")]
bool ContrastSupported { [Bind ("isContrastSupported")] get; }

[Export ("contrastAmount")]
float ContrastAmount { get; set; }

[Export ("detailSupported")]
bool DetailSupported { [Bind ("isDetailSupported")] get; }

[Export ("detailAmount")]
float DetailAmount { get; set; }

[Export ("moireReductionSupported")]
bool MoireReductionSupported { [Bind ("isMoireReductionSupported")] get; }

[Export ("moireReductionAmount")]
float MoireReductionAmount { get; set; }

[Export ("localToneMapSupported")]
bool LocalToneMapSupported { [Bind ("isLocalToneMapSupported")] get; }

[Export ("localToneMapAmount")]
float LocalToneMapAmount { get; set; }

[Export ("extendedDynamicRangeAmount")]
float ExtendedDynamicRangeAmount { get; set; }

[Export ("neutralChromaticity", ArgumentSemantic.Assign)]
CGPoint NeutralChromaticity { get; set; }

[Export ("neutralLocation", ArgumentSemantic.Assign)]
CGPoint NeutralLocation { get; set; }

[Export ("neutralTemperature")]
float NeutralTemperature { get; set; }

[Export ("neutralTint")]
float NeutralTint { get; set; }

[NullAllowed, Export ("linearSpaceFilter", ArgumentSemantic.Retain)]
CIFilter LinearSpaceFilter { get; set; }

[NullAllowed, Export ("previewImage")]
CIImage PreviewImage { get; }

[NullAllowed, Export ("portraitEffectsMatte")]
CIImage PortraitEffectsMatte { get; }

[NullAllowed, Export ("semanticSegmentationSkinMatte")]
CIImage SemanticSegmentationSkinMatte { get; }

[NullAllowed, Export ("semanticSegmentationHairMatte")]
CIImage SemanticSegmentationHairMatte { get; }

[NullAllowed, Export ("semanticSegmentationGlassesMatte")]
CIImage SemanticSegmentationGlassesMatte { get; }

[NullAllowed, Export ("semanticSegmentationSkyMatte")]
CIImage SemanticSegmentationSkyMatte { get; }

[NullAllowed, Export ("semanticSegmentationTeethMatte")]
CIImage SemanticSegmentationTeethMatte { get; }

[Static]
[Export ("filterWithImageURL:")]
[return: NullAllowed]
CIRawFilter Create (NSUrl url);

[Static]
[Export ("filterWithImageData:identifierHint:")]
[return: NullAllowed]
CIRawFilter Create (NSData data, [NullAllowed] string identifierHint);

[Static]
[Export ("filterWithCVPixelBuffer:properties:")]
[return: NullAllowed]
CIRawFilter Create (CVPixelBuffer buffer, NSDictionary properties);
}

[Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[TV (10,0)]
[Static]
[Internal]
Expand Down Expand Up @@ -792,6 +1006,9 @@ interface CIRawFilterKeys {
NSString ActiveKeysKey { get; }
}

[Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'CIRawFilter' instead.")]
[Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CIRawFilter' instead.")]
[TV (10,0)]
[StrongDictionary ("CIRawFilterKeys")]
interface CIRawFilterOptions {
Expand Down Expand Up @@ -2252,6 +2469,13 @@ interface CIImageProvider {
[BaseType (typeof (NSObject))]
[DisableDefaultCtor] // avoid crashes
interface CIKernel {

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0)]
[Static]
[Export ("kernelsWithMetalString:error:")]
[return: NullAllowed]
CIKernel[] FromMetalSource (string source, [NullAllowed] out NSError error);

[Deprecated (PlatformName.iOS, 12, 0)]
[Deprecated (PlatformName.MacOSX, 10, 14)]
[Static, Export ("kernelsWithString:")]
Expand Down Expand Up @@ -2291,7 +2515,7 @@ interface CIKernel {
[Export ("name")]
string Name { get; }

#if MONOMAC
#if MONOMAC || __MACCATALYST__
[Export ("setROISelector:")]
void SetRegionOfInterestSelector (Selector aMethod);
#endif
Expand Down Expand Up @@ -9353,11 +9577,20 @@ interface CILinearLightBlendMode : CIFilterProtocol {
[Mac (12,0)]
[MacCatalyst (15,0)]
[BaseType (typeof (CIFilter))]
interface CIPersonSegmentation : CIFilterProtocol {
interface CIPersonSegmentation : CIPersonSegmentationProtocol {
}

[CoreImageFilterProperty ("inputQualityLevel")]
// 0 == accurate, 1 == balanced, 2 == fast
int QualityLevel { get; set; }
[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0)]
[Protocol (Name="CIPersonSegmentation")]
interface CIPersonSegmentationProtocol : CIFilterProtocol {

[Abstract]
[NullAllowed, Export ("inputImage", ArgumentSemantic.Retain)]
CIImage InputImage { get; set; }

[Abstract]
[Export ("qualityLevel")]
nuint QualityLevel { get; set; }
}

[CoreImageFilter]
Expand Down

5 comments on commit b9cde5e

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

Packages generated

View packages

Test results

2 tests failed, 241 tests passed.

Failed tests

  • introspection/Mac Catalyst [dotnet]/Debug [dotnet]: Failed (Tests run: 44 Passed: 40 Inconclusive: 0 Failed: 1 Ignored: 3)
  • fsharp/Mac [dotnet]/Debug [dotnet]: TimedOut (Execution timed out after 1200 seconds.
    No test log file was produced)

Pipeline on Agent XAMBOT-1036.BigSur'
Merge pull request #12601 from rachelkang/xcode13.0-coreimage-b1-b3

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
Merge pull request #12601 from rachelkang/xcode13.0-coreimage-b1-b3

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
Merge pull request #12601 from rachelkang/xcode13.0-coreimage-b1-b3

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ Tests passed on macOS M1 - Mac Big Sur (11.5) ✅

Tests passed

All tests on macOS X M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent
Merge pull request #12601 from rachelkang/xcode13.0-coreimage-b1-b3

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ Tests passed on macOS Mac Mojave (10.14) ✅

Tests passed

All tests on macOS X Mac Mojave (10.14) passed.

Pipeline on Agent
Merge pull request #12601 from rachelkang/xcode13.0-coreimage-b1-b3

Please sign in to comment.