flo_draw icon indicating copy to clipboard operation
flo_draw copied to clipboard

CMYK in software renderer (WIP)

Open virtulis opened this issue 4 months ago • 1 comments

This is quite a mess right now and nowhere near ready, but making a PR in case you have an opinion on the matter :)

(Plus, surprisingly, it does seem to work somewhat already)

My main concern is the fact that CMYK colors don't make much sense in RGB when decoupled from color profile. So I see at least three ways of handling this:

  • Just make sure CMYK and RGB colors/pixels don't mix, ever, and leave any conversion between the two to the user. This is what I did right now with a bunch of todo!s, which could just become panic!s instead.
  • Add a feature to integrate with lcms2 and/or a trait for custom conversion implementation, to be used by the renderer(?) when needed. I worry this can get very slow and/or inaccurate, and will probably require otherwise pointless arguments to a bunch of functions.
  • Transparently convert between CMYK/RGB linearly. This will avoid panics but also lead to entirely wrong results in ways that might not be obvious.

The first option seems to be the simplest and safest, if not pretty.

virtulis avatar Aug 30 '25 13:08 virtulis