On Thu, 12 Feb 2026 11:39:33 GMT, Michael Strauß <[email protected]> wrote:
>> When a non-opaque scene fill color is used with a stage style other than
>> `StageStyle.TRANSPARENT`, the actual fill color is always white. This
>> doesn't work well when the scene uses a dark color scheme. A practical
>> solution is to allow non-opaque scene fill colors, and blend them on top of
>> a white or black background (depending on color scheme) to derive an opaque
>> color that adapts intuitively to the color scheme.
>>
>> To test this, simply create a scene that uses a non-opaque fill color and
>> observe the scene background when the color scheme is changed.
>>
>> This PR includes a system test, run it with:
>>
>> ./gradlew -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests
>> test.robot.javafx.scene.SceneFillTest.testSceneFill
>
> Michael Strauß has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Clear background to dominant fill color
This works well on macOS 26.2 (did not test windows/linux).
My biggest gripe is the amount of extra code and effort brought in to slightly
improve the flickering color.
In fact, I suspect the added computation might actually exacerbate the problem
in the case of image, since it has to compute the background color using
non-trivial and time-consuming algorithms.
I would think it might work just as well simply by using the black/white
background corresponding to the current theme. I am curious what other
reviewers would say.
modules/javafx.graphics/src/main/java/com/sun/javafx/image/ImageUtils.java line
82:
> 80: sampleStep = 1;
> 81: } else {
> 82: sampleStep = (int)Math.ceil(Math.sqrt((double)numPixels /
> (double)maxSamples));
`(double)numPixels`
typecast is not needed
modules/javafx.graphics/src/main/java/javafx/scene/Scene.java line 380:
> 378: addEventFilter(TouchEvent.TOUCH_PRESSED, pressedHandler);
> 379:
> 380: context.colorSchemeProperty().addListener((_, _, newValue) ->
> markDirty(DirtyBits.DARK_SCHEME_DIRTY));
`newValue` is not used, should it be an invalidation listener instead?
-------------
PR Review: https://git.openjdk.org/jfx/pull/2068#pullrequestreview-3781296469
PR Review Comment: https://git.openjdk.org/jfx/pull/2068#discussion_r2805852420
PR Review Comment: https://git.openjdk.org/jfx/pull/2068#discussion_r2790022865