[coreimage] Add generator support for CIVector[] and enable it in CIMeshGenerator. Fix #4226 (#4715)
This commit is contained in:
Родитель
c1593fbd1f
Коммит
807efadf38
|
@ -5569,9 +5569,8 @@ namespace CoreImage {
|
|||
[Mac (10,14, onlyOn64: true)]
|
||||
[BaseType (typeof (CIFilter))]
|
||||
interface CIMeshGenerator {
|
||||
// https://github.com/xamarin/xamarin-macios/issues/4226
|
||||
//[CoreImageFilterProperty ("inputMesh")]
|
||||
//CIVector [] Mesh { get; set; }
|
||||
[CoreImageFilterProperty ("inputMesh")]
|
||||
CIVector [] Mesh { get; set; }
|
||||
[CoreImageFilterProperty ("inputWidth")]
|
||||
float Width { get; set; }
|
||||
[CoreImageFilterProperty ("inputColor")]
|
||||
|
|
|
@ -199,6 +199,10 @@ public partial class Generator {
|
|||
// NSString should not be added - it should be bound as a string
|
||||
print ("return (string) (ValueForKey (\"{0}\") as NSString);", propertyName);
|
||||
break;
|
||||
case "CIVector[]":
|
||||
print ($"var handle = GetHandle (\"{propertyName}\");");
|
||||
print ("return NSArray.ArrayFromHandle<CIVector> (handle);");
|
||||
break;
|
||||
default:
|
||||
throw new BindingException (1018, true, "Unimplemented CoreImage property type {0}", propertyType);
|
||||
}
|
||||
|
@ -247,6 +251,20 @@ public partial class Generator {
|
|||
print ("SetValue (\"{0}\", ns);", propertyName);
|
||||
indent--;
|
||||
break;
|
||||
case "CIVector[]":
|
||||
print ("if (value == null) {");
|
||||
indent++;
|
||||
print ($"SetHandle (\"{propertyName}\", IntPtr.Zero);");
|
||||
indent--;
|
||||
print ("} else {");
|
||||
indent++;
|
||||
print ("using (var array = NSArray.FromNSObjects (value))");
|
||||
indent++;
|
||||
print ($"SetHandle (\"{propertyName}\", array.GetHandle ());");
|
||||
indent--;
|
||||
indent--;
|
||||
print ("}");
|
||||
break;
|
||||
default:
|
||||
throw new BindingException (1018, true, "Unimplemented CoreImage property type {0}", propertyType);
|
||||
}
|
||||
|
|
|
@ -153,6 +153,20 @@ namespace MonoTouchFixtures.CoreImage {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CIVectorArray ()
|
||||
{
|
||||
TestRuntime.AssertXcodeVersion (10, 0);
|
||||
|
||||
using (var f = new CIMeshGenerator ()) {
|
||||
Assert.Null (f.Mesh, "Mesh/Null");
|
||||
f.Mesh = new CIVector [1] { new CIVector (1) };
|
||||
Assert.That (f.Mesh.Length, Is.EqualTo (1), "Mesh/Non-null");
|
||||
f.Mesh = null;
|
||||
Assert.Null (f.Mesh, "Mesh/Null/again");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче