Skip to content

Commit

Permalink
[CoreImage] Enabled ImageRepresentation strong dictionary helpers, fi…
Browse files Browse the repository at this point in the history
…xes bugzilla #59294 (#3240)

https://bugzilla.xamarin.com/show_bug.cgi?id=59294

This enables ImageRepresentation strong dictionary helpers.

--- A note about WrapAttribute

Whenever we use the `WrapAttribute` inside a `Category` we need to
include the `This` parameter as the first argument inside the Wrap
signature, like the following example:

```csharp

[Wrap ("WriteTiffRepresentation (This, image, url, format, colorSpace, options?.Dictionary, out error)")]
bool WriteTiffRepresentation (CIImage image, NSUrl url, CIFormat format, CGColorSpace colorSpace, CIImageRepresentationOptions options, out NSError error);
```
  • Loading branch information
dalexsoto authored and spouliot committed Jan 17, 2018
1 parent 580ad2b commit daf74d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
8 changes: 8 additions & 0 deletions docs/website/binding_types_reference_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1916,6 +1916,14 @@ interface XyzPanel {
}
```

When the `WrapAttribute` is used inside a `Category` you need to include `This` as
the first argument inside the `Wrap` signature, for example:

```
[Wrap ("Write (This, image, options?.Dictionary, out error)")]
bool Write (CIImage image, CIImageRepresentationOptions options, out NSError error);
```

The members generated by `[Wrap]` are not `virtual` by default, if you need a `virtual` member you can set to `true` the optional `isVirtual` parameter.

```
Expand Down
32 changes: 8 additions & 24 deletions src/coreimage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,88 +399,72 @@ interface CIContext_ImageRepresentation {
[return: NullAllowed]
NSData GetTiffRepresentation (CIImage image, CIFormat format, CGColorSpace colorSpace, NSDictionary options);

#if false // [Wrap] does not support [Category] extension methods - https://bugzilla.xamarin.com/show_bug.cgi?id=59294
[iOS (10,0)][Mac (10,12)]
[Wrap ("GetTiffRepresentation (image, format, colorSpace, options?.Dictionary)")]
[Wrap ("GetTiffRepresentation (This, image, format, colorSpace, options?.Dictionary)")]
[return: NullAllowed]
NSData GetTiffRepresentation (CIImage image, CIFormat format, CGColorSpace colorSpace, CIImageRepresentationOptions options);
#endif

[iOS (10,0)][Mac (10,12)]
[Export ("JPEGRepresentationOfImage:colorSpace:options:")]
[return: NullAllowed]
NSData GetJpegRepresentation (CIImage image, CGColorSpace colorSpace, NSDictionary options);

#if false // [Wrap] does not support [Category] extension methods - https://bugzilla.xamarin.com/show_bug.cgi?id=59294
[iOS (10,0)][Mac (10,12)]
[Wrap ("GetJpegRepresentation (image, format, colorSpace, options?.Dictionary)")]
[Wrap ("GetJpegRepresentation (This, image, colorSpace, options?.Dictionary)")]
[return: NullAllowed]
NSData GetJpegRepresentation (CIImage image, CGColorSpace colorSpace, CIImageRepresentationOptions options);
#endif

[iOS (11,0)][TV (11,0)][Mac (10,13)]
[Export ("HEIFRepresentationOfImage:format:colorSpace:options:")]
[return: NullAllowed]
NSData GetHeifRepresentation (CIImage image, CIFormat format, CGColorSpace colorSpace, NSDictionary options);

#if false // [Wrap] does not support [Category] extension methods - https://bugzilla.xamarin.com/show_bug.cgi?id=59294
[iOS (11,0)][TV (11,0)][Mac (10,13)]
[Wrap ("GetHeifRepresentation (image, format, colorSpace, options?.Dictionary)")]
[Wrap ("GetHeifRepresentation (This, image, format, colorSpace, options?.Dictionary)")]
[return: NullAllowed]
NSData GetHeifRepresentation (CIImage image, CIFormat format, CGColorSpace colorSpace, CIImageRepresentationOptions options);
#endif

[iOS (11,0)][TV (11,0)][Mac (10,13)]
[Export ("PNGRepresentationOfImage:format:colorSpace:options:")]
[return: NullAllowed]
NSData GetPngRepresentation (CIImage image, CIFormat format, CGColorSpace colorSpace, NSDictionary options);

#if false // [Wrap] does not support [Category] extension methods - https://bugzilla.xamarin.com/show_bug.cgi?id=59294
[iOS (11,0)][TV (11,0)][Mac (10,13)]
[Wrap ("GetPngRepresentation (image, format, colorSpace, options?.Dictionary)")]
[Wrap ("GetPngRepresentation (This, image, format, colorSpace, options?.Dictionary)")]
[return: NullAllowed]
NSData GetPngRepresentation (CIImage image, CIFormat format, CGColorSpace colorSpace, CIImageRepresentationOptions options);
#endif

[iOS (10,0)][Mac (10,12)]
[Export ("writeTIFFRepresentationOfImage:toURL:format:colorSpace:options:error:")]
bool WriteTiffRepresentation (CIImage image, NSUrl url, CIFormat format, CGColorSpace colorSpace, NSDictionary options, out NSError error);

#if false // [Wrap] does not support [Category] extension methods - https://bugzilla.xamarin.com/show_bug.cgi?id=59294
[iOS (10,0)][Mac (10,12)]
[Wrap ("WriteTiffRepresentation (image, url, format, colorSpace, options?.Dictionary, out error)")]
[Wrap ("WriteTiffRepresentation (This, image, url, format, colorSpace, options?.Dictionary, out error)")]
bool WriteTiffRepresentation (CIImage image, NSUrl url, CIFormat format, CGColorSpace colorSpace, CIImageRepresentationOptions options, out NSError error);
#endif

[iOS (10,0)][Mac (10,12)]
[Export ("writeJPEGRepresentationOfImage:toURL:colorSpace:options:error:")]
bool WriteJpegRepresentation (CIImage image, NSUrl url, CGColorSpace colorSpace, NSDictionary options, [NullAllowed] out NSError error);

#if false // [Wrap] does not support [Category] extension methods - https://bugzilla.xamarin.com/show_bug.cgi?id=59294
[iOS (10,0)][Mac (10,12)]
[Wrap ("WriteJpegRepresentation (image, url, format, colorSpace, options?.Dictionary, out error)")]
[Wrap ("WriteJpegRepresentation (This, image, url, colorSpace, options?.Dictionary, out error)")]
bool WriteJpegRepresentation (CIImage image, NSUrl url, CGColorSpace colorSpace, CIImageRepresentationOptions options, [NullAllowed] out NSError error);
#endif

[iOS (11,0)][TV (11,0)][Mac (10,13)]
[Export ("writeHEIFRepresentationOfImage:toURL:format:colorSpace:options:error:")]
bool WriteHeifRepresentation (CIImage image, NSUrl url, CIFormat format, CGColorSpace colorSpace, NSDictionary options, [NullAllowed] out NSError error);

#if false // [Wrap] does not support [Category] extension methods - https://bugzilla.xamarin.com/show_bug.cgi?id=59294
[iOS (11,0)][TV (11,0)][Mac (10,13)]
[Wrap ("WriteHeifRepresentation (image, url, format, colorSpace, options?.Dictionary, out error)")]
[Wrap ("WriteHeifRepresentation (This, image, url, format, colorSpace, options?.Dictionary, out error)")]
bool WriteHeifRepresentation (CIImage image, NSUrl url, CIFormat format, CGColorSpace colorSpace, CIImageRepresentationOptions options, [NullAllowed] out NSError error);
#endif

[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);

#if false // [Wrap] does not support [Category] extension methods - https://bugzilla.xamarin.com/show_bug.cgi?id=59294
[iOS (11,0)][TV (11,0)][Mac (10,13)]
[Wrap ("WritePngRepresentation (image, url, format, colorSpace, options?.Dictionary, out error)")]
[Wrap ("WritePngRepresentation (This, image, url, format, colorSpace, options?.Dictionary, out error)")]
bool WritePngRepresentation (CIImage image, NSUrl url, CIFormat format, CGColorSpace colorSpace, CIImageRepresentationOptions options, [NullAllowed] out NSError error);
#endif
}

[BaseType (typeof (NSObject))]
Expand Down

0 comments on commit daf74d6

Please sign in to comment.