Quartz 2D/OpenGLES geometric distortions on images (preferrably using CGImage)

你说的曾经没有我的故事 提交于 2019-12-03 10:16:39

问题


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


回答1:


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 ]



来源:https://stackoverflow.com/questions/459108/quartz-2d-opengles-geometric-distortions-on-images-preferrably-using-cgimage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!