Skip to content

CoreImage iOS xcode9 beta1

Sebastien Pouliot edited this page Aug 31, 2017 · 4 revisions

#CoreImage.framework

Sebastien

diff -ruN /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIContext.h /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIContext.h
--- /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIContext.h	2016-08-10 20:27:20.000000000 -0400
+++ /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIContext.h	2017-05-23 01:18:58.000000000 -0400
@@ -378,6 +382,10 @@
 
 @interface CIContext (ImageRepresentation)
 
+CORE_IMAGE_EXPORT NSString * const kCIImageRepresentationAVDepthData NS_AVAILABLE(10_13,11_0);
+CORE_IMAGE_EXPORT NSString * const kCIImageRepresentationDepthImage NS_AVAILABLE(10_13,11_0);
+CORE_IMAGE_EXPORT NSString * const kCIImageRepresentationDisparityImage NS_AVAILABLE(10_13,11_0);
+
 /* Render a CIImage to TIFF data. Image must have a finite non-empty extent. */
 /* The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome */
 /* and must match the specified CIFormat. */
@@ -389,11 +397,33 @@
 
 
+/* Render a CIImage to HEIF data. Image must have a finite non-empty extent. */
+/* The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome */
+/* and must match the specified CIFormat. */
+/* Supported options keys are kCGImageDestinationLossyCompressionQuality, */
+/* kCIImageRepresentationAVDepthData, kCIImageRepresentationDepthImage, */
+/* kCIImageRepresentationDisparityImage. */
+- (nullable NSData*) HEIFRepresentationOfImage:(CIImage*)image
+                                        format:(CIFormat)format
+                                    colorSpace:(CGColorSpaceRef)colorSpace
+                                       options:(NSDictionary*)options NS_AVAILABLE(10_13,11_0);
+
+/* Render a CIImage to PNG data. Image must have a finite non-empty extent. */
+/* The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome */
+/* and must match the specified CIFormat. */
+/* No options keys are supported at this time. */
+- (nullable NSData*) PNGRepresentationOfImage:(CIImage*)image
+                                       format:(CIFormat)format
+                                   colorSpace:(CGColorSpaceRef)colorSpace
+                                      options:(NSDictionary*)options NS_AVAILABLE(10_13,11_0);
+
 /* Render a CIImage to TIFF file. Image must have a finite non-empty extent. */
 /* The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome */
 /* and must match the specified CIFormat. */
@@ -405,15 +435,41 @@
                                 options:(NSDictionary*)options
                                   error:(NSError **)errorPtr NS_AVAILABLE(10_12,10_0);
 
+/* Render a CIImage to PNG file. Image must have a finite non-empty extent. */
+/* The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome */
+/* and must match the specified CIFormat. */
+/* No options keys are supported at this time. */
+- (BOOL) writePNGRepresentationOfImage:(CIImage*)image
+                                 toURL:(NSURL*)url
+                                format:(CIFormat)format
+                            colorSpace:(CGColorSpaceRef)colorSpace
+                               options:(NSDictionary*)options
+                                 error:(NSError **)errorPtr NS_AVAILABLE(10_13,11_0);
+
 /* Render a CIImage to JPEG file. Image must have a finite non-empty extent. */
 /* The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome. */
 
+/* Render a CIImage to HEIF file. Image must have a finite non-empty extent. */
+/* The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome */
+/* and must match the specified CIFormat. */
+/* Supported options keys are kCGImageDestinationLossyCompressionQuality, */
+/* kCIImageRepresentationAVDepthData, kCIImageRepresentationDepthImage, */
+/* kCIImageRepresentationDisparityImage. */
+- (BOOL) writeHEIFRepresentationOfImage:(CIImage*)image
+                                  toURL:(NSURL*)url
+                                 format:(CIFormat)format
+                             colorSpace:(CGColorSpaceRef)colorSpace
+                                options:(NSDictionary*)options
+                                  error:(NSError **)errorPtr NS_AVAILABLE(10_12,10_0);
+
 
 @end
 
diff -ruN /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h
--- /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h	2016-08-06 02:33:42.000000000 -0400
+++ /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h	2017-05-20 00:41:58.000000000 -0400
@@ -71,6 +79,10 @@
  * If [NSNull null] then dont color manage the image. */
 CORE_IMAGE_EXPORT NSString * const kCIImageColorSpace;
 
+/* A boolean value specifying whether the image should sampled using "nearest neighbor" 
+ * behavior.  If not specified, the image will be sampled using "linear sampling" */
+CORE_IMAGE_EXPORT NSString * const kCIImageNearestSampling NS_AVAILABLE(10_13, 11_0);
+
 
 /* A NSDictionary of metadata properties to pass to CIImage initialization methods.
  * When used with imageWithCGImage:options:, initWithCGImage:options:, imageWithData:options:, initWithData:options:
@@ -83,6 +95,17 @@
 CORE_IMAGE_EXPORT NSString * const kCIImageTextureFormat NS_AVAILABLE_MAC(10_9);
 
 
+/* The kCIImageAuxiliaryDepth or kCIImageAuxiliaryDisparity keys can be passed to the methods:
+ + [CIImage imageWithContentsOfURL:options:]
+ + [CIImage imageWithData:options:]
+ If the value of one of these keys is @YES, the auxiliary image be return instead of the primary image.
+ If an auxiliary image is not present, then nil will be returned.
+ The returned image will be a half float monochrome image.
+ */
+CORE_IMAGE_EXPORT NSString * const kCIImageAuxiliaryDepth NS_AVAILABLE(10_13, 11_0);
+CORE_IMAGE_EXPORT NSString * const kCIImageAuxiliaryDisparity NS_AVAILABLE(10_13, 11_0);
+
+
 /* Creates a new image from the contents of 'image'. */
 + (CIImage *)imageWithCGImage:(CGImageRef)image;
 + (CIImage *)imageWithCGImage:(CGImageRef)image
@@ -295,6 +320,13 @@
 /* Return a new image by changing the recevier's properties. */
 - (CIImage *)imageBySettingProperties:(NSDictionary*)properties NS_AVAILABLE(10_12, 10_0);
 
+/* Returns a new image by changing the receiver's sample mode to bilinear interpolation. */
+- (CIImage *)imageBySamplingLinear NS_AVAILABLE(10_13, 11_0)
+  NS_SWIFT_NAME(samplingLinear());
+
+/* Returns a new image by changing the receiver's sample mode to nearest neighbor. */
+- (CIImage *)imageBySamplingNearest NS_AVAILABLE(10_13, 11_0)
+  NS_SWIFT_NAME(samplingNearest());
 
 /* Return a rect the defines the bounds of non-(0,0,0,0) pixels */
 @property (NS_NONATOMIC_IOSONLY, readonly) CGRect extent;
@@ -324,6 +356,10 @@
  * Otherwise this property will be nil and calling [CIContext createCGImage:fromRect:] is recommended. */
 @property (nonatomic, readonly, nullable) CGImageRef CGImage NS_AVAILABLE(10_12,10_0);
 
+/* Returns a AVDepthData if the CIImage was created with [CIImage imageWithData] or [CIImage imageWithURL] and.
+ * one the options kCIImageAuxiliaryDepth or kCIImageAuxiliaryDisparity. */
+@property (nonatomic, readonly, nullable) AVDepthData *depthData NS_AVAILABLE(10_13,11_0);
+
 /* Returns the rectangle of 'image' that is required to render the
  * rectangle 'rect' of the receiver.  This may return a null rect. */
 - (CGRect)regionOfInterestForImage:(CIImage *)image
diff -ruN /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImageProcessor.h /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImageProcessor.h
--- /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImageProcessor.h	2016-08-12 00:56:42.000000000 -0400
+++ /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImageProcessor.h	2017-05-19 22:49:32.000000000 -0400
@@ -82,6 +82,16 @@
 +(CIFormat)outputFormat;
 #endif
 
+// Override this class property if your processor's output stores 1.0 into the
+// alpha channel of all pixels within the output extent.
+// If not overridden, false is returned.
+//
+#if __has_feature(objc_class_property)
+@property (class, readonly) bool outputIsOpaque NS_AVAILABLE(10_13, 11_0);
+#else
++ (bool)outputIsOpaque NS_AVAILABLE(10_13, 11_0);
+#endif
+
 // Override this class property to return false if you want your processor to be given
 // CIImageProcessorInput objects that have not been synchonized for CPU access.
 //
diff -ruN /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIKernel.h /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIKernel.h
--- /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIKernel.h	2016-08-12 00:56:42.000000000 -0400
+++ /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIKernel.h	2017-05-19 22:49:32.000000000 -0400
@@ -60,6 +61,21 @@
  */
 + (nullable instancetype)kernelWithString:(NSString *)string  NS_AVAILABLE(10_10, 8_0);
 
+/* The data argument should represent a metallib file compiled with the Core Image Standard Library
+ * and contain the given function written in the Metal Shading Language.
+ *
+ * An optional output pixel format can be specified, and would be used if the output of the kernel
+ * needs to be written to an intermediate texture.
+ */
++ (nullable instancetype)kernelWithFunctionName:(NSString *)name
+                           fromMetalLibraryData:(NSData *)data
+                                          error:(NSError **)error NS_AVAILABLE(10_13, 11_0);
+
++ (nullable instancetype)kernelWithFunctionName:(NSString *)name
+                           fromMetalLibraryData:(NSData *)data
+                              outputPixelFormat:(CIFormat)format
+                                          error:(NSError **)error NS_AVAILABLE(10_13, 11_0);
+
 /* The name of the kernel. */
 @property (atomic, readonly) NSString *name  NS_AVAILABLE(10_4, 8_0);
 
@@ -188,4 +204,87 @@
                             arguments:(nullable NSArray<id> *)args;
 @end
 
diff -ruN /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIKernelMetalLib.h /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIKernelMetalLib.h
--- /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIKernelMetalLib.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIKernelMetalLib.h	2017-05-23 01:40:39.000000000 -0400
@@ -0,0 +1,103 @@
+//
+//  Extensions to Metal Shading Language for Core Image Kernels
+//
+//  Copyright (c) 2017 Apple, Inc. All rights reserved.
+//
+
+#if __METAL_MACOS__ || __METAL_IOS__
+
+#include <metal_stdlib>
+
+namespace coreimage
+{
+    using namespace metal;
+    
+    typedef float4 sample_t;
+    
+    //MARK: - Sampler
+    
+    typedef struct
+    {
+        // Returns the pixel value produced from sampler at the position p, where p is specified in sampler space.
+        float4 sample(float2 p) const;
+        
+        // Returns the position in the coordinate space of the source that is associated with the position defined in working-space coordinates.
+        float2 transform(float2 p) const;
+        
+        // Returns the position, in sampler space, of the sampler that is associated with the current output pixel (that is, after any transformation matrix
+        // associated with sampler is applied). The sample space refers to the coordinate space of that you are texturing from. Note that if your source data is tiled,
+        // the sample coordinate will have an offset (dx/dy). You can convert a destination location to the sampler location using the transform function.
+        float2 coord() const;
+        
+        // Returns the extent of the sampler in world coordinates, as a four-element vector [x, y, width, height].
+        float4 extent() const;
+        
+        inline float2 origin() const { return extent().xy; }
+        inline float2 size() const { return extent().zw; }
+        
+    private:
+        texture2d<float, access::sample> t;
+        sampler s;
+        constant float4x4& m;
+        float2 dc;
+        
+    } sampler;
+    
+    // Global equivalents of sampler struct member functions, to facilitate porting of non-Metal legacy CI kernels.
+    
+    // Equivalent to src.sample(p)
+    float4 sample (sampler src, float2 p);
+    
+    // Equivalent to src.transform(p)
+    float2 samplerTransform (sampler src, float2 p);
+    
+    // Equivalent to src.coord()
+    float2 samplerCoord (sampler src);
+    
+    // Equivalent to src.extent()
+    float4 samplerExtent (sampler src);
+    
+    // Equivalent to src.origin()
+    float2 samplerOrigin (sampler src);
+    
+    // Equivalent to src.size()
+    float2 samplerSize (sampler src);
+    
+    //MARK: - Destination
+    
+    typedef struct
+    {
+        // Returns the position, in working space coordinates, of the pixel currently being computed.
+        // The destination space refers to the coordinate space of the image you are rendering.
+        inline float2 coord() const { return c; }
+        
+    private:
+        float2 c;
+        
+    } destination;
+    
+    //MARK: - Common Functions
+    
+    float4 premultiply(float4 s);
+    float4 unpremultiply(float4 s);
+    
+    float3 srgb_to_linear(float3 s);
+    float3 linear_to_srgb(float3 s);
+    
+    //MARK: - Relational Functions
+    
+    // for each component, returns x < 0 ? y : z
+    float  compare(float  x, float  y, float  z);
+    float2 compare(float2 x, float2 y, float2 z);
+    float3 compare(float3 x, float3 y, float3 z);
+    float4 compare(float4 x, float4 y, float4 z);
+    
+    //MARK: - Math Functions
+    
+    float2 cossin(float x);
+    float2 sincos(float x);
+}
+
+namespace ci = coreimage;
+
+#endif /* __METAL_MACOS__ || __METAL_IOS__ */
diff -ruN /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIRenderDestination.h /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIRenderDestination.h
--- /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIRenderDestination.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode9-beta1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIRenderDestination.h	2017-05-23 01:18:58.000000000 -0400
@@ -0,0 +1,278 @@
+/*
+ CoreImage - CIRenderDestination.h
+ 
+ Copyright (c) 2017 Apple, Inc.
+ All rights reserved.
+ */
+
+
+#import <Foundation/Foundation.h>
+#import <CoreImage/CoreImageDefines.h>
+#import <CoreImage/CIImage.h>
+#import <CoreImage/CIContext.h>
+#import <CoreImage/CIKernel.h>
+#import <CoreVideo/CoreVideo.h>
+#if !TARGET_OS_SIMULATOR
+#import <IOSurface/IOSurfaceObjC.h>
+#endif
+#import <Metal/MTLPixelFormat.h>
+
+@protocol MTLTexture, MTLCommandBuffer;
+
+NS_ASSUME_NONNULL_BEGIN
+
+
+// This is a lightweight API to allow clients to specify all the
+// attributes of a render that pertain to the render's destination.
+// It is intended to be used for issuing renders that return to the
+// caller as soon as all the work has been issued but before it completes/
+//
+NS_CLASS_AVAILABLE(10_13, 11_0)
+@interface CIRenderDestination : NSObject
+{
+    void *_priv;
+}
+
+// MARK: PixelBuffer destinations
+
+// Create a CIRenderDestination based on a CVPixelBufferRef object.
+//
+// The destination's 'colorspace' property will default a CGColorSpace created by,
+// querying the CVPixelBufferRef attributes.
+//
+- (instancetype) initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer;
+
+// MARK: Surface destinations
+
+#if !TARGET_OS_SIMULATOR
+// Create a CIRenderDestination based on an IOSurface object.
+//
+// The destination's 'colorspace' property will default a CGColorSpace created by,
+// querying the IOSurface attributes.
+//
+- (instancetype) initWithIOSurface:(IOSurface*)surface;
+#endif
+
+// MARK: Metal destinations
+
+// A render to a MTLTexture-backed CIRenderDestination is only supported by MTLTexture-backed CIContexts.
+// The texture must have a MTLTextureType of MTLTextureType2D
+//
+// An optional MTLCommandBuffer can be specified, with which to use for rendering to the MTLTexture.
+//
+// The destination's 'colorspace' property will default a CGColorSpace created with kCGColorSpaceSRGB,
+// kCGColorSpaceExtendedSRGB, or kCGColorSpaceGenericGrayGamma2_2.
+//
+- (instancetype) initWithMTLTexture:(id<MTLTexture>)texture
+                      commandBuffer:(nullable id<MTLCommandBuffer>)commandBuffer;
+
+// Create a CIRenderDestination based on a Metal texture.
+//
+// Rendering to a MTLTexture-backed CIRenderDestination is only supported by MTLTexture-backed CIContexts.
+// The provider 'block' will be called lazily when the destination is rendered to.
+// The block must return a texture with a MTLTextureType of MTLTextureType2D.
+// The 'width', 'height' and 'pixelFormat' argument values should be the same as the
+// width, height and pixelFormat of the MTLTexture that will be returned by 'block'
+//
+// An optional MTLCommandBuffer can be specified, with which to use for rendering to the MTLTexture.
+//
+// The destination's 'colorspace' property will default a CGColorSpace created with kCGColorSpaceSRGB,
+// kCGColorSpaceExtendedSRGB, or kCGColorSpaceGenericGrayGamma2_2.
+//
+- (instancetype) initWithWidth:(NSUInteger)width
+                        height:(NSUInteger)height
+                   pixelFormat:(MTLPixelFormat)pixelFormat
+                 commandBuffer:(nullable id<MTLCommandBuffer>)commandBuffer
+            mtlTextureProvider:(id<MTLTexture> (^)(void))block;
+
+// MARK: OpenGL destination
+
+// Create a CIRenderDestination based on an OpenGL texture.
+//
+// Rendering to a GLTexture-backed CIRenderDestination is only supported by GLContext-backed CIContexts.
+// The texture id must be bound to a GLContext that is shared with that of the GLContext-backed CIContext.
+//
+// The destination's 'colorspace' property will default a CGColorSpace created with kCGColorSpaceSRGB,
+// kCGColorSpaceExtendedSRGB, or kCGColorSpaceGenericGrayGamma2_2.
+//
+- (instancetype) initWithGLTexture:(unsigned int)texture
+		                    target:(unsigned int)target // GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_EXT
+                             width:(NSUInteger)width
+                            height:(NSUInteger)height;
+
+// MARK: Bitmap data destination
+
+// Create a CIRenderDestination based on client-managed buffer.
+//
+// The 'data' parameter must point to a buffer that is at least bytesPerRow * height bytes in size.
+// 
+// The destination's 'colorspace' property will default a CGColorSpace created with kCGColorSpaceSRGB,
+// kCGColorSpaceExtendedSRGB, or kCGColorSpaceGenericGrayGamma2_2.
+- (instancetype) initWithBitmapData:(void *)data
+                              width:(NSUInteger)width
+                             height:(NSUInteger)height
+                        bytesPerRow:(NSUInteger)bytesPerRow
+                             format:(CIFormat)format;
+
+
+// MARK: Properties
+
+@property (readonly) NSUInteger width;
+@property (readonly) NSUInteger height;
+
+
+typedef NS_ENUM(NSUInteger, CIRenderDestinationAlphaMode) {
+    CIRenderDestinationAlphaNone            = 0,
+    CIRenderDestinationAlphaPremultiplied   = 1,
+    CIRenderDestinationAlphaUnpremultiplied = 2
+};
+
+// This property will defualt to an appropriate value given
+// the object that the CIRenderDestination was initialized with.
+// This property can be  set to a different value if desired.
+@property CIRenderDestinationAlphaMode alphaMode;
+
+// The logical coordinate system of a CIRenderDestination is always cartesian:
+//   (0,0) represents the lower-left corner
+//   (0.5,0.5) represents the lower-left pixel center
+//   (pixelsWide-0.5,pixelsHigh-0.5) represents the upper-right pixel center
+//   (pixelsWide,pixelsHigh) represents the upper-right corner.
+//
+// The 'flipped' property controls how pixels this logical coordinate system
+// are stored into the memory of the object backing the destination.
+//
+// If 'flipped' is false, then the base address of the backing stores the
+// pixel centered on the logical coordinate (0.5,0.5)
+//
+// If 'flipped' is true, then the base address of the backing stores the
+// pixel centered on the logical coordinate (pixelsWide-0.5,0.5)
+//
+@property (getter=isFlipped) BOOL flipped;
+
+// Instructs the render to add pseudo-random luma noise given the depth of the destination.
+// The magnitude of the noise is approximatly ±pow(2,-(bitPerComponent+1))
+@property (getter=isDithered) BOOL dithered;
+
+// If true, the render will clamp color channels
+// to 0..alpha if 'alphaMode' is premultiplied otherwise 0..1
+// This property is initialized to false if the destination's format supports extended range
+@property (getter=isClamped) BOOL clamped;
+
+// This property will defualt to an appropriate value given
+// the object that the CIRenderDestination was initialized with.
+// This property can be  set to a different colorSpace if desired.
+// This property can be set to nil to disable color matching
+// from the working space to the destination.
+@property (nullable, nonatomic) CGColorSpaceRef colorSpace;
+
+// Allow client to specify a CIBlendKernel (e.g. CIBlendKernel.sourceOver)
+// to be used on the destination.
+// Currently the blendKernel cannot be set if 'alphaMode' is unpremultiplied
+@property (nullable, nonatomic, retain) CIBlendKernel* blendKernel;
+
+// If true, then the blendKernel is applied in the destination's colorSpace.
+// If false, then the blendKernel is applied in the CIContext's working colorspace.
+// This is false by default.
+@property BOOL blendsInDestinationColorSpace;
+
+@end
+
+
+// An Xcode quicklook of this object will show a graph visualization of the render
+// with detailed timing information.
+NS_CLASS_AVAILABLE(10_13, 11_0)
+@interface CIRenderInfo : NSObject
+{
+    void *_priv;
+}
+
+// This property will return how many passes the render requires.
+// If passCount is 1 than the render can be fully concatinated and no
+// intermediate buffers will be required.
+@property (readonly) NSInteger passCount;
+
+// This property will return how much time a render spent executing kernels.
+@property (readonly) NSTimeInterval kernelExecutionTime;
+
+// This property will return how many pixels a render produced executing kernels.
+@property (readonly) NSInteger kernelPixelsProcessed;
+
+@end
+
+
+
+// An Xcode quicklook of this object will show a graph visualization of the render
+NS_CLASS_AVAILABLE(10_13, 11_0)
+@interface CIRenderTask : NSObject
+{
+    void *_priv;
+}
+
+- (nullable CIRenderInfo*) waitUntilCompletedAndReturnError:(NSError**)error;
+
+@end
+
+
+@interface CIContext (CIRenderDestination)
+
+// Renders a portion of image to a point of destination
+// It renders as if 'image' is cropped to 'fromRect'
+// and the origin of the result is placed at 'atPoint'
+//
+// If image.extent and fromRect are infinite, then it renders
+// so that point (0,0) of image is placed at 'atPoint'
+//
+// MTLTexture-backed CIRenderDestinations are only supported by MTLTexture-backed CIContexts.
+// GLTexture-backed CIRenderDestinations are only supported by GLContext-backed CIContexts.
+//
+// This call will return as soon as all the work for the render is enqueued on the
+// context's device.
+//
+// In many situations, after issuing a render, the client can use the destination
+// or its backing object without waiting for the enqueued work to complete.
+// For example, after rendering a surface CIRenderDestination, the surface can be passed
+// on for further processing by the GPU.
+//
+// In other situations, the client may need to wait for the render to be complete.
+// For example, after rendering a surface CIRenderDestination, the surface can be accessed
+// by CPU code by calling IOSurfaceGetBytePointer only after the render is completed.
+//
+// In this case the client can use the returned CIRenderTask like this:
+//   CIRenderTask* task = [context render:...];
+//   [task waitUntilCompletedAndReturnError:&error];
+//
+- (nullable CIRenderTask*) startTaskToRender:(CIImage*)image
+                                    fromRect:(CGRect)fromRect
+                               toDestination:(CIRenderDestination*)destination
+                                     atPoint:(CGPoint)atPoint
+                                       error:(NSError**)error NS_AVAILABLE(10_13, 11_0);
+
+// Renders an image to a destination so that point (0,0) of image.
+// is placed at point (0,0) of the destination.
+//
+- (nullable CIRenderTask*) startTaskToRender:(CIImage*)image
+                               toDestination:(CIRenderDestination*)destination
+                                       error:(NSError**)error NS_AVAILABLE(10_13, 11_0);
+
+
+// This is an optional call which can be used to "warm up" a CIContext so that
+// a subsequent call to render with the same arguments can be more efficient.
+// By making this call, Core Image will ensure that
+//  - any needed kernels will be compiled
+//  - any intermedate buffers are allocated and marked volatile
+//
+- (BOOL) prepareRender:(CIImage*)image
+              fromRect:(CGRect)fromRect
+         toDestination:(CIRenderDestination*)destination
+               atPoint:(CGPoint)atPoint
+                 error:(NSError**)error NS_AVAILABLE(10_13, 11_0);
+
+// Fill the entire destination with black (0,0,0,1) if its alphaMode is None
+// or clear (0,0,0,0) if its alphaMode is Premultiplied or Unpremultiplied.
+//
+- (nullable CIRenderTask*) startTaskToClear:(CIRenderDestination*)destination
+                                      error:(NSError**)error NS_AVAILABLE(10_13, 11_0);
+
+@end
+
+NS_ASSUME_NONNULL_END
Clone this wiki locally