A WIP proposal on how to add color management
This is a minimal change as outlined in #182. The main points being:
- All code is inside an ifdef, if it is not enabled, then build output should be identical to current Cairo
- The implementation has the smallest possible changes to demonstrate the issue
- Internally everything is still RGB, gray colors are converted immediately to RGB and only back to gray when used
- Grayscale output is enabled only for PDF
A proper implementation would probably need to store the internal colors in some sort of a calibrated, linear colorspace (but also using CMYK colors in PDF should pass them through directly rather than doing a roundtrip color conversion call).
The idea of this MR is that it allows to work on a suitable API and implementation incrementally without breaking existing code. A possible series of steps could be;
- add this grayscale support
- add support for linear RGB colorspaces
- add support for CMYK
- work on improving the API
Once a proper API and implementation have been found, the unstable ifdef can be removed. If something fails, then reverting all the code is simple.