Render CIIMage to CVPixelBuffer in arbitrary position

I need to render an image into / onto a CVPixelBuffer in an arbitrarilty positioned rectangle this was working fine using


render:toCVPixelBuffer:bounds:colorSpace:


but the functionality of the bounds parameter changed with IOS 9, and now I can only get it to render to the bottom left corner. Am I missing another API that will let me render to anywhere within the bounds of CVPixelBuffer? I've looked and so far have been confounded.


thanks for any pointers to other APIs that might work.


... From the header docs...


/ Render 'image' to the given CVPixelBufferRef.

* The 'bounds' parameter has the following behavior:

* In OS X and iOS 9 and later: The 'image' is rendered into 'buffer' so that

* point (0,0) of 'image' aligns to the lower left corner of 'buffer'.

* The 'bounds' acts like a clip rect to limit what region of 'buffer' is modified.

* In iOS 8 and earlier: The 'bounds' parameter acts to specify the region of 'image' to render.

* This region (regarless of its origin) is rendered at upper-left corner of 'buffer'.

* If 'colorSpace' is nil, CI will not color match to the destination.

*/

Found my own fix.. this moves the image 800 pixels on the x axis..


CGAffineTransform trans = CGAffineTransformMakeTranslation(800,0);

image = [image imageByApplyingTransform:trans1];

[context render:image toCVPixelBuffer:pixelBuffer bounds:image.extent colorSpace:colorSpaceRef];

I too have no idea how this works. I had to translate the image after cropping.
Render CIIMage to CVPixelBuffer in arbitrary position
 
 
Q