Skip to content
Open
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
45 changes: 26 additions & 19 deletions src/coreimage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5931,9 +5931,10 @@ interface CIAreaAverageProtocol : CIFilterProtocol {
[MacCatalyst (13, 1)]
[BaseType (typeof (CIReductionFilter))]
interface CIAreaAverage {

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputImageNonMPS")]
CIImage OutputImageNonMps { get; }
#endif

[iOS (13, 4)]
[MacCatalyst (13, 1)]
Expand Down Expand Up @@ -5990,6 +5991,7 @@ interface CIAreaHistogram : CIAreaHistogramProtocol {
[CoreImageFilterProperty ("inputExtent")]
CIVector Extent { get; set; }

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputImageNonMPS")]
CIImage OutputImageNonMps { get; }

Expand All @@ -6001,6 +6003,7 @@ interface CIAreaHistogram : CIAreaHistogramProtocol {

[CoreImageFilterProperty ("outputData")]
NSData OutputData { get; }
#endif
}

[CoreImageFilter]
Expand Down Expand Up @@ -6096,8 +6099,10 @@ interface CICodeGenerator {
[MacCatalyst (13, 1)]
[BaseType (typeof (CICodeGenerator))]
interface CIAztecCodeGenerator : CIAztecCodeGeneratorProtocol {
#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputCGImage")]
CGImage OutputCGImage { get; }
#endif
}

/// <summary>A <see cref="CoreImage.CITransitionFilter" /> that animates a transition between two images.</summary>
Expand Down Expand Up @@ -6359,9 +6364,10 @@ interface CICmykHalftone : CICmykHalftoneProtocol {
[MacCatalyst (13, 1)]
[BaseType (typeof (CICodeGenerator))]
interface CICode128BarcodeGenerator : CICode128BarcodeGeneratorProtocol {

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputCGImage")]
CIImage OutputCGImage { get; }
#endif
}

/// <summary>An abstract <see cref="CoreImage.CIFilter" /> that combines a background and foreground image.</summary>
Expand Down Expand Up @@ -7315,8 +7321,10 @@ interface CIParallelogramTile : CIParallelogramTileProtocol {
[MacCatalyst (13, 1)]
[BaseType (typeof (CICodeGenerator), Name = "CIPDF417BarcodeGenerator")]
interface CIPdf417BarcodeGenerator : CIPdf417BarcodeGeneratorProtocol {
#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputCGImage")]
CGImage OutputCGImage { get; }
#endif
}

/// <summary>A <see cref="CoreImage.CIPerspectiveTransform" /> that is cropped according to the perspective control points, but whose pixels are not transformed.</summary>
Expand Down Expand Up @@ -7480,9 +7488,10 @@ interface CIPointillize : CIPointillizeProtocol {
[MacCatalyst (13, 1)]
[BaseType (typeof (CICodeGenerator))]
interface CIQRCodeGenerator : CIQRCodeGeneratorProtocol {

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputCGImage")]
CGImage OutputCGImage { get; }
#endif
}

/// <include file="../docs/api/CoreImage/CIRadialGradient.xml" path="/Documentation/Docs[@DocId='T:CoreImage.CIRadialGradient']/*" />
Expand Down Expand Up @@ -8079,7 +8088,7 @@ interface CIAttributedTextImageGenerator : CIAttributedTextImageGeneratorProtoco
[MacCatalyst (13, 1)]
[BaseType (typeof (CIFilter))]
interface CIBarcodeGenerator : CIBarcodeGeneratorProtocol {

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputCGImageForQRCodeDescriptor")]
CGImage OutputCGImageForQRCodeDescriptor { get; }

Expand All @@ -8094,6 +8103,7 @@ interface CIBarcodeGenerator : CIBarcodeGeneratorProtocol {

[CoreImageFilterProperty ("outputCGImage")]
CGImage OutputCGImage { get; }
#endif
}

[CoreImageFilter]
Expand Down Expand Up @@ -9217,14 +9227,15 @@ interface CIAreaMinMaxProtocol : CIAreaReductionFilterProtocol {
[MacCatalyst (13, 1)]
[BaseType (typeof (CIReductionFilter))]
interface CIAreaMinMax : CIAreaReductionFilterProtocol {

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputImageNonMPS")]
CIImage OutputImageNonMps { get; }

[iOS (13, 4)]
[MacCatalyst (13, 1)]
[CoreImageFilterProperty ("outputImageMPS")]
CIImage OutputImageMps { get; }
#endif
}

[CoreImageFilter]
Expand Down Expand Up @@ -9448,9 +9459,10 @@ interface CIKeystoneCorrection {
[MacCatalyst (13, 1)]
[BaseType (typeof (CIKeystoneCorrection))]
interface CIKeystoneCorrectionCombined : CIKeystoneCorrectionCombinedProtocol {

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputTransform")]
CGAffineTransform OutputTransform { get; }
#endif
}

[CoreImageFilter]
Expand All @@ -9459,14 +9471,10 @@ interface CIKeystoneCorrectionCombined : CIKeystoneCorrectionCombinedProtocol {
[MacCatalyst (13, 1)]
[BaseType (typeof (CIKeystoneCorrection))]
interface CIKeystoneCorrectionHorizontal : CIKeystoneCorrectionHorizontalProtocol {

#if false // no documentation about the type
[CoreImageFilterProperty ("outputRotationFilter")]
NSObject OutputRotationFilter { get; }
#endif

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputTransform")]
CGAffineTransform OutputTransform { get; }
#endif
}

[CoreImageFilter]
Expand All @@ -9475,14 +9483,10 @@ interface CIKeystoneCorrectionHorizontal : CIKeystoneCorrectionHorizontalProtoco
[MacCatalyst (13, 1)]
[BaseType (typeof (CIKeystoneCorrection))]
interface CIKeystoneCorrectionVertical : CIKeystoneCorrectionVerticalProtocol {

#if false // no documentation about the type
[CoreImageFilterProperty ("outputRotationFilter")]
CGAffineTransform OutputRotationFilter { get; }
#endif

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputTransform")]
CGAffineTransform OutputTransform { get; }
#endif
}

[CoreImageFilter]
Expand All @@ -9491,9 +9495,10 @@ interface CIKeystoneCorrectionVertical : CIKeystoneCorrectionVerticalProtocol {
[MacCatalyst (13, 1)]
[BaseType (typeof (CIFilter))]
interface CIPerspectiveRotate : CIPerspectiveRotateProtocol {

#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputTransform")]
CGAffineTransform OutputTransform { get; }
#endif
}

[CoreImageFilter]
Expand Down Expand Up @@ -13789,8 +13794,10 @@ interface CIRoundedQRCodeGeneratorProtocol : CIFilterProtocol {
[TV (26, 0), Mac (26, 0), iOS (26, 0), MacCatalyst (26, 0)]
[BaseType (typeof (CIFilter))]
interface CIRoundedQRCodeGenerator : CIRoundedQRCodeGeneratorProtocol {
#if !XAMCORE_5_0
[CoreImageFilterProperty ("outputCGImage")]
CGImage OutputCGImage { get; }
#endif
}

[TV (26, 0), Mac (26, 0), iOS (26, 0), MacCatalyst (26, 0)]
Expand Down
78 changes: 18 additions & 60 deletions tests/introspection/ApiCoreImageFiltersTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
//

using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

Expand Down Expand Up @@ -155,9 +156,13 @@ public void CheckManagedFilters ()
static void GenerateBinding (NSObject filter, TextWriter writer)
{
NSObject value;
var f = (CIFilter) filter;
var attributes = (filter as CIFilter).Attributes;

writer.WriteLine ("[CoreImageFilter]");
writer.WriteLine ($"/* Attributes for this filter REMOVE-ME:\n\n{attributes}\n\n */");
writer.WriteLine ($"/* Input Keys for this filter: {string.Join (", ", f.InputKeys.Select (v => v.ToString ()).OrderBy (v => v))} */");
writer.WriteLine ($"/* Output Keys for this filter: {string.Join (", ", f.OutputKeys.Select (v => v.ToString ()).OrderBy (v => v))} */");

if (!attributes.TryGetValue ((NSString) "CIAttributeFilterAvailable_iOS", out value)) {
writer.WriteLine ("[NoiOS]");
Expand Down Expand Up @@ -389,6 +394,7 @@ public void Keys ()
continue;

CIFilter f = ctor.Invoke (null) as CIFilter;
var attributes = f.Attributes;

// first check that every property can be mapped to an input key - except if it starts with "Output"
foreach (var p in t.GetProperties (BindingFlags.Public | BindingFlags.Instance)) {
Expand Down Expand Up @@ -458,6 +464,13 @@ public void Keys ()

// second check that every input key is mapped to an property
foreach (var key in f.InputKeys) {
if (!attributes.ContainsKey ((NSString) key)) {
// We're assuming that if an input key doesn't have an entry in the attributes, then it shouldn't really be used.
// Also, we don't know how to bind it anyway, because the (missing) entry in the attributes is where Apple describes the property type.
/// Console.WriteLine ($"{t.Name}: Input key '{key}' does not have a corresponding entry in the attributes");
continue;
}

string cap = Char.ToUpperInvariant (key [0]) + key.Substring (1);
// special cases (protocol names are better)
switch (t.Name) {
Expand Down Expand Up @@ -507,66 +520,11 @@ public void Keys ()

// third check that every output key is mapped to an property
foreach (var key in f.OutputKeys) {
// special cases
switch (t.Name) {
case "CIKeystoneCorrectionCombined":
case "CIKeystoneCorrectionHorizontal":
case "CIKeystoneCorrectionVertical":
switch (key) {
case "outputRotationFilter":
continue; // lack of documentation about the returned type
}
break;
case "CILanczosScaleTransform":
switch (key) {
// ref: https://github.com/dotnet/macios/issues/7209
case "outputImageNewScaleX:scaleY:":
case "outputImageOldScaleX:scaleY:":
continue;
}
break;
case "CIDiscBlur":
switch (key) {
// existed in iOS 10.3 but not in iOS 13 - we're not adding them
case "outputImageOriginal":
case "outputImageEnhanced":
continue;
}
break;
case "CIGaussianBlur":
switch (key) {
case "outputImageV1":
// existed briefly in macOS 10.11, but neither before nor after.
continue;
}
break;
case "CIAreaAverage":
case "CIAreaHistogram":
case "CIAreaMinMax":
switch (key) {
case "outputImageMPS":
case "outputImageMPS:":
case "outputImageNonMPS:":
// no doc for argument
continue;
}
break;
case "CIAreaLogarithmicHistogram":
switch (key) {
case "outputImageNonMPS":
case "outputData":
case "outputImageMPS":
// no doc for argument
continue;
}
break;
case "CIToneMapHeadroom":
switch (key) {
case "outputValue:":
// no doc for argument
continue;
}
break;
if (key != "outputImage" && !attributes.ContainsKey ((NSString) key)) {
// We're assuming that if an output key doesn't have an entry in the attributes, then it shouldn't really be used.
// Also, we don't know how to bind it anyway, because the (missing) entry in the attributes is where Apple describes the property type.
// Console.WriteLine ($"{t.Name}: Output key '{key}' does not have a corresponding entry in the attributes");
continue;
}

var cap = Char.ToUpperInvariant (key [0]) + key.Substring (1);
Expand Down
Loading