Dear all,
I am looking in depth into java2d pipelines (composite, mask fill) to understand if the alpha blending is performed correctly (gamma correction, color mixing).
FYI, I read a lot of articles related to color blending ans its problems related to gamma correction & color spaces.
I think that java compositing is gamma corrected (sRGB) but suffers bad color mixing (luminance and saturation issue).
Look at this article for correct color mixing:
http://www.stuartdenman.com/improved-color-blending/
Correct gamma correction:
http://www.chez-jim.net/agg/gamma-correct-rendering-part-3
I figured out that:
1- gamma correction seems performed by the java2d pipeline (AlphaComposite.srcOver) ie sRGB => linear RGB (blending)
2- alpha mask filling (maskFill / maskBlit operators) are implemented in C (software, opengl or xrender variants) but it is incorrect:
For alpha = 50% (byte=128) => a black line over a white background gives middle gray (byte=128 and not byte=192): it uses linear on sRGB values instead of linear RGB values => gamma correction should be fixed !
3- colors are mixed in RGB color space => yellow + blue = gray issue !
I could try implementing RGB<=>CIE-Lch color mixing ...