I'm currently working on a cross-platform application for iOS and Android, and I'm using Skia to handle graphics rendering. When creating an SkSurface
that represents an app window, I'm uncertain about the best approach to selecting a color space.
My primary goal is to choose a color space that accurately represents the capabilities of the device's display. At the moment, I'm passing null for the color space when creating the SkSurface
, but I'm not convinced that this is the optimal choice. Here's a snippet of my current implementation:
auto surface = SkSurface::MakeRasterN32Premul(width, height, /*colorSpace=*/ nullptr);
Here are my specific concerns and questions:
Best Practice for Color Space Selection: What is the recommended method to determine and select a color space that best matches the display capabilities of different iOS and Android devices?
Device Capability Detection: Is there a way to programmatically detect the optimal color space for a device in Skia, especially for devices with wide color gamut capabilities like Display P3 on newer iOS devices?
Performance Considerations: How significant is the performance impact when choosing a more complex color space, such as P3, compared to the default or no color space? I'm worried that opting for a high-fidelity color space might adversely affect the app's rendering performance.
Fallback Strategies: If a device does not support the chosen color space (e.g., P3), what is the best fallback strategy to ensure consistent color rendering across diverse devices?
Any insights or advice on handling color spaces in Skia for mobile applications would be greatly appreciated, especially regarding performance trade-offs and ensuring the best visual fidelity on a wide range of devices.