
-----Original Message----- From: Krzysztof Kosiński [mailto:tweenk.pl@...400...] Sent: 22 February 2011 00:05
2011/2/21 <J.B.C.Engelen@...1887...>:
Hi all, I just committed a new display mode: grayscale. It is separate from the other display modes. The grayscale mode is a "Color display mode", see the menu. When activated, it shows all colors in grayscale on-canvas. This does not (yet?) influence exporting, or saving. It
only
concerns the on-canvas view of the file, like outline display mode.
Display modes should not affect exporting or saving, by design. Grayscale exporting should be handled using a preference in the export dialog.
Ivan suggested that export would copy the grayscale setting, as is done in Xara apparently. I am neutral on this issue.
Right now, there is no preference to change the grayscale calculation. At the moment it uses: grayscale value = 0.33 * red + 0.59 * green + 0.11 * blue. I found this somewhere on internet, but forgot where,
and
it might be wrong/unusual. I intended to add a preference setting for these values, but have not done so. Let me know if that is desired.
The calculation should match the luminosity formula found in SVG filters and masks definition, which is: 0.2125 * R + 0.7154 * G + 0.0721 * B Additionally, the calculation should be performed in linear RGB, which means you need to convert between sRGB and that. The conversion formulas can be found e.g. here in the section "useful data": http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/
Since it was meant as a quick preview mode for color figures, I figured it does not make too much sense to go all out to make it 100% correct. Probably the real grayscale output depends on which printer you have anyway. But as Jon suggested, I can use the LCMS stuff and make everybody happy.
The feature will probably need some tweaks or a partial rewrite in order to work with the Cairo branch.
I was afraid of this, but implemented it anyway :P Perhaps I can help a bit once you are done with Cairoing. At least the boilerplate stuff of verbs, menus, etc., is done now. The actual grayscale code was only half a line of code... Hope you can finish the work soon. It'd be better for your mental health I think!
Cheers, Johan