【问题标题】:How to change the perspective of the image view? [duplicate]如何改变图像视图的视角? [复制]
【发布时间】:2012-08-29 00:45:33
【问题描述】:

可能重复:
How do I apply a perspective transform to a UIView?

如何改变图像视图的透视、3D 变换、倾斜、扭曲、旋转?任何示例项目。提前致谢

【问题讨论】:

  • 能否请您改写我没有得到您的问题...
  • 能否请您更简单地描述一下您的问题
  • 图像处理,如 3D 变换、旋转、倾斜和扭曲。此过程的任何示例源代码或任何想法
  • 查看 openGL 格式或 FiltrrApp、NYXImagesKit 等项目。
  • 我使用的是普通的 UIImage 视图,而不是使用 OpenGL。任何想法都会改变图像的视角。

标签: iphone uiimageview uiimage


【解决方案1】:

3D 变换、旋转、倾斜等通常使用CATransform3D 完成。

根据文档 (Core Animation Programming Guide):

CATransform3D 数据结构定义了一个同构的 三维变换(一个 4 x 4 的 CGFloat 值矩阵) 用于旋转、缩放、偏移、倾斜和应用透视 转换为图层。

例如,要向右下角进行 3D 旋转,您可以执行以下操作:

myImageView.layer.transform = CATransform3DRotate(CATransform3DIdentity, 1.75, 0.85, 0, 0);

别忘了

#import <QuartzCore/QuartzCore.h>

Mark Pospesel 的Enter the Matrix 是一个很棒的示例项目。 The code is on GitHub,也可以查看explanatory slides

【讨论】:

  • 非常感谢。 EnterTheMatrix 是一款很棒的应用程序。再次感谢您的指导。
猜你喜欢
  • 2020-10-09
  • 1970-01-01
  • 2021-12-15
  • 1970-01-01
  • 1970-01-01
  • 2016-04-22
  • 2017-01-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多