Integrated: 8354191: GTK LaF should use pre-multiplied alpha same as cairo
Maxim Kartashev
mkartashev at openjdk.org
Thu Apr 17 07:01:52 UTC 2025
On Wed, 9 Apr 2025 14:42:05 GMT, Maxim Kartashev <mkartashev at openjdk.org> wrote:
> The pixels that cairo produces for GTK LaF to draw on a Swing component have their alpha components pre-multiplied as per [the documentation](https://www.cairographics.org/manual/cairo-Image-Surfaces.html?spm=a2ty_o01.29997173.0.0.540ac921z2EebT#cairo-format-t):
>> Pre-multiplied alpha is used. (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)
>
> The BufferedImage created from those pixels, however, has its constructor's argument for `isRasterPremultiplied` set to `false` in `GTKEngine.finishPainting()`. This commit corrects that.
>
> In addition, since at least some "native" graphics color models also use pre-multiplied alpha (ex.: `GLXGraphicsConfig.getColorModel()`), `COLOR_MODELS` were modified to take advantage of that and avoid unnecessary re-calculations of image's pixels.
This pull request has now been integrated.
Changeset: a4e9da37
Author: Maxim Kartashev <mkartashev at openjdk.org>
Committer: Alexey Ushakov <avu at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/a4e9da3747fe0a3c27e414787eaa97f80b24f5de
Stats: 22 lines in 1 file changed: 12 ins; 7 del; 3 mod
8354191: GTK LaF should use pre-multiplied alpha same as cairo
Reviewed-by: avu, prr
-------------
PR: https://git.openjdk.org/jdk/pull/24551
More information about the client-libs-dev
mailing list