1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 */ 7 8 #import <UIKit/UIKit.h> 9 10 #import <ABI48_0_0React/ABI48_0_0RCTBridge.h> 11 #import <ABI48_0_0React/ABI48_0_0RCTImageURLLoader.h> 12 #import <ABI48_0_0React/ABI48_0_0RCTResizeMode.h> 13 #import <ABI48_0_0React/ABI48_0_0RCTURLRequestHandler.h> 14 15 /** 16 * Provides the interface needed to register an image decoder. Image decoders 17 * are also bridge modules, so should be registered using ABI48_0_0RCT_EXPORT_MODULE(). 18 */ 19 @protocol ABI48_0_0RCTImageDataDecoder <ABI48_0_0RCTBridgeModule> 20 21 /** 22 * Indicates whether this handler is capable of decoding the specified data. 23 * Typically the handler would examine some sort of header data to determine 24 * this. 25 */ 26 - (BOOL)canDecodeImageData:(NSData *)imageData; 27 28 /** 29 * Decode an image from the data object. The method should call the 30 * completionHandler when the decoding operation has finished. The method 31 * should also return a cancellation block, if applicable. 32 * 33 * If you provide a custom image decoder, you most implement scheduling yourself, 34 * to avoid decoding large amounts of images at the same time. 35 */ 36 - (ABI48_0_0RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData 37 size:(CGSize)size 38 scale:(CGFloat)scale 39 resizeMode:(ABI48_0_0RCTResizeMode)resizeMode 40 completionHandler:(ABI48_0_0RCTImageLoaderCompletionBlock)completionHandler; 41 42 @optional 43 44 /** 45 * If more than one ABI48_0_0RCTImageDataDecoder responds YES to `-canDecodeImageData:` 46 * then `decoderPriority` is used to determine which one to use. The decoder 47 * with the highest priority will be selected. Default priority is zero. 48 * If two or more valid decoders have the same priority, the selection order is 49 * undefined. 50 */ 51 - (float)decoderPriority; 52 53 @end 54