Community
Participate
Working Groups
A semi-transparent color (0 < alpha < 255) is drawn 'over' a fully opaque colored area. What is the resulting color? Please provide Color or RGB API to calculate the resulting (opaque) color from an initial opaque and an 'over' drawn, possibly semi transparent color. Background: macOS reports some system colors like SWT.COLOR_SELECTION with an alpha channel < 255. I need to know what color to draw to achieve the desired effect.
Wouldn't this depend on what the color "underneath" is? I don't think this is something Color can provide us independently.
Of course, this depends on the already existing color. Something like RGB calculateOverOperation(RGB baseColor, RGB drawingColorWithAlpha); See also https://en.wikipedia.org/wiki/Alpha_compositing. In AWT it's about drawing with AlphaComposite.SRC_OVER. The code already should exist somewhere in SWT, if I remember correctly, because of GTK or macOS returning alpha-blended colors.