views:

1035

answers:

1

What is the preferred method for implementing such geometric distortions as pinch/fisheye/etc. using the iPhone SDK? I know that the Core Image library for OSX has all these types of filters built in, but not for the iPhone SDK.

I can create a displacement map at a specific location and radius given the original source bitmap data, but I'm not sure how to apply this bitmap data as a transformation on my CGImage.

This isn't an affine transformation since lines are no longer parallel around the area of distortion/etc.

Is it possible using CGImage or would I need to do this using OpenGLES?

Thanks

A: 

Actually, Flash 8's DisplacementMapFilter entry describes the general displacement map transformation given a displacement map made up of pixels component(x,y) as follows:

dstPixel[x, y] = srcPixel[ x + ((componentX(x, y) - 128) * scaleX) / 256, y + ((componentY(x, y) - 128) * scaleY) / 256 ]

abraginsky