How can I display a CIImage* in a CALayer ?

I have an app which produces a stream of CIImage* from a CoreVideo Pipeline.
I would like to be able to display the stream of CIImage's as they are processed and I thought I could do this using the CIFilter functionality of the CALayer class. But I cannot seem to get the CIImage* displayed. Is this possible? What is the trick?

|K<

Replies

Hi Kent,

The filters you can add to a CALayer will apply to the layer's content, so they can't be used to display your own content (your CIImage) on the layer.

Instead, you could either convert your CIImage into a UIImage and display that in a UIImageView. But for a video stream this is not the best approach since UIImageView is not made for handling so many frames per second.
The most performant way is to render the CIImage into a MTKView (or a CAMetalLayer) using a CIContext. I created a project on GitHub to show how this can be done.

Hope this helps!