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

[CoreImage] Strong-type a format parameter to CIContext.CreateCGImage in .NET. #13829

Closed
Closed
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
2 changes: 2 additions & 0 deletions src/CoreImage/CIContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,12 @@ public static CIContext FromOptions (CIContextOptions? options)
return FromOptions (options?.Dictionary);
}

#if !NET
public CGImage? CreateCGImage (CIImage image, CGRect fromRect, CIFormat ciImageFormat, CGColorSpace? colorSpace)
{
return CreateCGImage (image, fromRect, CIImage.CIFormatToInt (ciImageFormat), colorSpace);
}
#endif
#endif
}
}
4 changes: 4 additions & 0 deletions src/coreimage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,11 @@ interface CIContext {
[Export ("createCGImage:fromRect:format:colorSpace:")]
[return: Release ()]
[return: NullAllowed]
#if NET
CGImage CreateCGImage (CIImage image, CGRect fromRect, CIFormat /* CIFormat = int */ ciImageFormat, [NullAllowed] CGColorSpace colorSpace);
#else
CGImage CreateCGImage (CIImage image, CGRect fromRect, int /* CIFormat = int */ ciImageFormat, [NullAllowed] CGColorSpace colorSpace);
#endif

[iOS (10,0)][Mac (10,12)]
[TV (10,0)]
Expand Down
4 changes: 4 additions & 0 deletions tests/monotouch-test/CoreImage/CoreContextTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ public void CreateRefCount ()
Assert.AreEqual (1, rc, "CreateCGImage #a1");
}

#if NET
using (var v = ctx.CreateCGImage (img, new CGRect (0, 0, 32, 32), CIFormat.ARGB8, null)) {
#else
using (var v = ctx.CreateCGImage (img, new CGRect (0, 0, 32, 32), CIImage.FormatARGB8, null)) {
#endif
int rc = Messaging.int_objc_msgSend (v.Handle, retainCount.Handle);
Assert.AreEqual (1, rc, "CreateCGImage #b1");
}
Expand Down