【发布时间】:2018-07-18 19:03:08
【问题描述】:
我想让点击的图像区域缩放。
当我将 GPUImageBulgeDistortionFilter 应用于图像时,它在中心点 (0.5 , 0.5) 处正常工作,但是当中心点发生变化时,图像上的效果不会作为给定的中心点应用。
Image Square工作正常。
图像宽度 > 图像高度。中心点 (0.5, 0.2) 适用于 (0.5, 0.1) 中心点 (0.5, 0.8) 适用于 (0.5, 0.9)
图像宽度 。中心点 (0.5, 0.2) 应用于 (0.5, 0.3),中心点 (0.5, 0.8) 应用于 (0.5, 0.7)
func tapGesture(_ sender: Any){
let points = tap.location(ofTouch: 0, in: ivPic)
let stillImageFilter = GPUImageBulgeDistortionFilter()
stillImageFilter.center = CGPoint(x: points.x / ivPic.frame.size.width, y: points.y / ivPic.frame.size.height)
stillImageFilter.radius = 0.1
stillImageFilter.scale = 0.1
ivPic.image = stillImageFilter.image(byFilteringImage: ivPic.image)
}
【问题讨论】:
标签: ios swift image-processing uiimage gpuimage