Дім*_*мар 8 core-image ios metal
随着每个基于Metal的ImageView的实现,我都面临同样的问题
let targetTexture = currentDrawable?.texture else{ return }
Run Code Online (Sandbox Code Playgroud)
"MTLDrawable"类型的值没有成员"纹理"
好像苹果改变了一些金属api
这是我试用的全部功能:
func renderImage()
{
guard let
image = image,
let targetTexture = currentDrawable?.texture else{return}
let commandBuffer = commandQueue.makeCommandBuffer()
let bounds = CGRect(origin: CGPoint.zero, size: drawableSize)
let originX = image.extent.origin.x
let originY = image.extent.origin.y
let scaleX = drawableSize.width / image.extent.width
let scaleY = drawableSize.height / image.extent.height
let scale = min(scaleX, scaleY)
let scaledImage = image
.applying(CGAffineTransform(translationX: -originX, y: -originY))
.applying(CGAffineTransform(scaleX: scale, y: scale))
ciContext.render(scaledImage,
to: targetTexture,
commandBuffer: commandBuffer,
bounds: bounds,
colorSpace: colorSpace)
commandBuffer.present(currentDrawable!)
commandBuffer.commit()
}
Run Code Online (Sandbox Code Playgroud)
小智 20
执行系统和xcode更新后,我遇到了同样的问题.在更新过程中,xcode将构建目标切换到模拟器.一旦我将目标切换回设备,它就会再次编译.
| 归档时间: |
|
| 查看次数: |
1511 次 |
| 最近记录: |