RCTImageUtils Obj-C nullability annotations
Summary: Add Objective-C nullability annotations to RCTImageUtils public Reviewed By: nicklockwood Differential Revision: D2797310 fb-gh-sync-id: 08329f70d1a09bf47865c9e7e76d7b4340eb6e80
This commit is contained in:
parent
f421d2b056
commit
7d70b86a7b
|
@ -12,6 +12,8 @@
|
|||
|
||||
#import "RCTDefines.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This function takes an input content size (typically from an image), a target
|
||||
* size and scale that it will be drawn at (typically in a CGContext) and then
|
||||
|
@ -53,16 +55,16 @@ RCT_EXTERN CGSize RCTSizeInPixels(CGSize pointSize, CGFloat scale);
|
|||
* width/height of the returned image is guaranteed to be >= destSize.
|
||||
* Pass a destSize of CGSizeZero to decode the image at its original size.
|
||||
*/
|
||||
RCT_EXTERN UIImage *RCTDecodeImageWithData(NSData *data,
|
||||
CGSize destSize,
|
||||
CGFloat destScale,
|
||||
UIViewContentMode resizeMode);
|
||||
RCT_EXTERN UIImage *__nullable RCTDecodeImageWithData(NSData *data,
|
||||
CGSize destSize,
|
||||
CGFloat destScale,
|
||||
UIViewContentMode resizeMode);
|
||||
|
||||
/**
|
||||
* This function takes the source data for an image and decodes just the
|
||||
* metadata, without decompressing the image itself.
|
||||
*/
|
||||
RCT_EXTERN NSDictionary<NSString *, id> *RCTGetImageMetadata(NSData *data);
|
||||
RCT_EXTERN NSDictionary<NSString *, id> *__nullable RCTGetImageMetadata(NSData *data);
|
||||
|
||||
/**
|
||||
* Convert an image back into data. Images with an alpha channel will be
|
||||
|
@ -71,4 +73,6 @@ RCT_EXTERN NSDictionary<NSString *, id> *RCTGetImageMetadata(NSData *data);
|
|||
* conversion, with 1.0 being maximum quality. It has no effect for images
|
||||
* using PNG compression.
|
||||
*/
|
||||
RCT_EXTERN NSData *RCTGetImageData(CGImageRef image, float quality);
|
||||
RCT_EXTERN NSData *__nullable RCTGetImageData(CGImageRef image, float quality);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -207,10 +207,10 @@ CGSize RCTSizeInPixels(CGSize pointSize, CGFloat scale)
|
|||
};
|
||||
}
|
||||
|
||||
UIImage *RCTDecodeImageWithData(NSData *data,
|
||||
CGSize destSize,
|
||||
CGFloat destScale,
|
||||
UIViewContentMode resizeMode)
|
||||
UIImage *__nullable RCTDecodeImageWithData(NSData *data,
|
||||
CGSize destSize,
|
||||
CGFloat destScale,
|
||||
UIViewContentMode resizeMode)
|
||||
{
|
||||
CGImageSourceRef sourceRef = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
|
||||
if (!sourceRef) {
|
||||
|
@ -265,7 +265,7 @@ UIImage *RCTDecodeImageWithData(NSData *data,
|
|||
return image;
|
||||
}
|
||||
|
||||
NSDictionary<NSString *, id> *RCTGetImageMetadata(NSData *data)
|
||||
NSDictionary<NSString *, id> *__nullable RCTGetImageMetadata(NSData *data)
|
||||
{
|
||||
CGImageSourceRef sourceRef = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
|
||||
if (!sourceRef) {
|
||||
|
@ -276,7 +276,7 @@ NSDictionary<NSString *, id> *RCTGetImageMetadata(NSData *data)
|
|||
return (__bridge_transfer id)imageProperties;
|
||||
}
|
||||
|
||||
NSData *RCTGetImageData(CGImageRef image, float quality)
|
||||
NSData *__nullable RCTGetImageData(CGImageRef image, float quality)
|
||||
{
|
||||
NSDictionary *properties;
|
||||
CGImageDestinationRef destination;
|
||||
|
|
Loading…
Reference in New Issue