UIImage created from MTKView results in color/opacity differences

前端 未结 3 1235
-上瘾入骨i
-上瘾入骨i 2021-02-10 06:30

When I capture the contents of an MTKView into a UIImage, the resulting image looks qualitatively different, as shown below:

The code I use to generate the UIIm

3条回答
  •  春和景丽
    2021-02-10 07:16

    Your CGColorSpace is .sRGB but your renderPipelineDescriptor's pixelFormat is .bgra8Unorm. Try changing that line to:

    renderPipelineDescriptor.colorAttachments[0].pixelFormat = MTLPixelFormat.bgra8Unorm_srgb
    

提交回复
热议问题