[OpenJDK 2D-Dev] Marlin 0.9.5 with experimental pure-java alpha blending

Laurent Bourgès bourges.laurent at gmail.com
Tue Jul 28 08:24:21 UTC 2020


For 3 months I worked on an improved alpha blending method in the Marlin
renderer project (on github):

It is implemented as a pure-java  experimental code that rewrite alpha
compositing operations (SRC_OVER) to perform gamma-correction (sRGB
profile) before/after any pixel operation to properly mix colors in RGB
linear space.

As dark shades looks then lighter, in particular for font or thin shapes
(black over white), I implemented several correction algorithms based on
luminance & contrast correction that adjusts alpha values.

It is tricky as the ideal correction would require enlarging stroke width
or polygon fills... but it would change coverage algebra= overlaps... that
may need API enhancements at least. I forgave this direction as no simple &
automatic solution exists.
Finally I have 3 compositor modes: linear / hybrid / perceptual.

See the latest Marlin renderer 0.9.5 EA release notes:

Visual comparison:

It is only working up to now on buffered images (off-screen INT_ARGB) but
the performance (java + unsafe) is now as good as the former C software

I wonder if:
- there is any interest in improving java2d color handling in 2020 ? it is
a behaviour change that must be discussed first.
- how to proceed for a possible OpenJDK integration? Use java code like my
hack or fix C macros / loops to use this new approach / maths ?
- How to fix accelerated pipelines (opengl, directx, metal) too ?
- who would help me ?

Any comment or feedback on this topic ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/2d-dev/attachments/20200728/c997ebd4/attachment.htm>

More information about the 2d-dev mailing list