I have provided a link to a UIKit test app which displays three different images, side by side, each inside a separate MTKView. Each image is tagged with a different color profile:
- Display P3
- uRGB
- Test RGB
我为所有彩色空间和格式设定了缺省值。 然后,我检查图像是否贴上标签,如果是的话,我就从有色空间中推翻这些价值。
The variables I am setting:
- “workingColorSpace” in the Metal CIContext, default = sRGB
- “workingFormat” in the Metal CIContext, default = RGBAf
- “outputColorSpace” in the Metal CIContext, default = displayP3
- “colorPixelFormat” in the MTKView, default = bgra8Unorm
- “colorSpace” in a CIRenderDestination that I use in the MTKView delegate draw method
“宇宙空间”违约值 = CGColor SpaceCreateDeviceRGB(CGC)
我还在CIRenderDestination与MTKView.colorPixelFormat中确定了“pixelFormat”。
If the image is tagged, I override the following values with the tagged colorSpace:
- CIContext.workingColorSpace
- CIContext.outputColorSpace
- CIRenderDestination.colorSpace
如果挂图的彩色空间是真的,那么我就把CIRenderDestination.color Space确定为延伸SRGB,忽视了有色的宽加宽色空间的彩色空间,并确定了彩色PixelFormat = bgr10_xr
Results:
The above scenario will properly render the DisplayP3 image, and the uRGB image. The “Test RGB” image fails:
If I do not override the CIRenderDestination.colorSpace with a value from the tagged image, then the “Test RGB” image succeeds, but the “uRGB” image fails to render properly:
Question: Do I have everything hooked up correctly and, if so, why does one image fail, and the other succeed?
与抽样项目的联系:
https://www.drop Box.com/scl/fi/57u2fcrgdvys7jtzykzxt/Color Space Research.zip?rlkey=unjeeiu7mi0wx9wfpylt78nwd&dl=0