JDK-8123838 : FX 8 3D : BackgroundFill with a Color object creates a weird blending result on Windows
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-06-26
  • Updated: 2015-06-17
  • Resolved: 2013-09-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Duplicate :  
Description
A BackgroundFill with a Color object creates a weird blending result, LinearGradient and RadialGradient work fine (Windows only).

package jiraissue;

import javafx.animation.Interpolator;
import javafx.animation.RotateTransition;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.PointLight;
import javafx.scene.Scene;
import javafx.scene.SubScene;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.paint.CycleMethod;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.paint.Stop;
import javafx.scene.shape.Cylinder;
import javafx.scene.transform.Rotate;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import javafx.util.Duration;

public class BackgroundFillBlending extends Application {
    
    public static void main(String[] args) {
        launch(args);
    }
    
    @Override public void start(Stage stage) {
        
        // SubScene
        
        final Group subSceneRoot  = new Group();
        final SubScene subScene = new SubScene(subSceneRoot, 800, 800, true, false); 
        
        // SubScene's camera
        final PerspectiveCamera perspectiveCamera = new PerspectiveCamera(true);
        perspectiveCamera.setFarClip(25);
        perspectiveCamera.setNearClip(0.1);
        perspectiveCamera.setFieldOfView(44);
        
        subScene.setCamera(perspectiveCamera);
       
        // SubScene's light
        final PointLight pointLight = new PointLight(Color.WHITE);
        pointLight.setTranslateZ(-20000);
          
        // Viewing group: camera and headlight
        final Group viewingGroup = new Group(perspectiveCamera, pointLight);
        viewingGroup.setTranslateZ(-5);
        
        // 3D model
        Cylinder cylinder = new Cylinder();
        cylinder.setMaterial(new PhongMaterial(Color.ORANGE));
        
        final Group cylRotGroup = new Group(cylinder);
        
        final RotateTransition cylRotTransition = new RotateTransition();
        cylRotTransition.setNode(cylRotGroup);
        cylRotTransition.setAxis(Rotate.X_AXIS);
        cylRotTransition.setCycleCount(Timeline.INDEFINITE);
        cylRotTransition.setAutoReverse(false); 
        cylRotTransition.setInterpolator(Interpolator.LINEAR);
        cylRotTransition.setByAngle(360);
        cylRotTransition.setDuration(Duration.millis(10000));
       
        subSceneRoot.getChildren().addAll(cylRotGroup, viewingGroup);
        
        // Scene
                        
        // SubScene's parent
        final BorderPane borderPane = new BorderPane();       
        borderPane.setMinHeight(0);
        borderPane.setMinWidth(0);

        // Background
        
        final Stop[] stopsLG = new Stop[] {new Stop(0.0, Color.YELLOW),
                                           new Stop(1.0, Color.LIGHTYELLOW)};
        final LinearGradient lg = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stopsLG);   
        
        final Background yellowGradientBG = new Background(new BackgroundFill(lg, null, null));       
        final Background yellowColortBG = new Background(new BackgroundFill(Color.YELLOW, null, null));

        final ToggleGroup bgToggleGroup = new ToggleGroup();
        final RadioButton bgColorRadio = new RadioButton("Color");
        final RadioButton bgGradientRadio = new RadioButton("LinearGradient");
        bgColorRadio.setToggleGroup(bgToggleGroup);
        bgGradientRadio.setToggleGroup(bgToggleGroup);
        bgGradientRadio.setSelected(true);
        
        bgColorRadio.setOnAction(new EventHandler<ActionEvent>() {
            @Override public void handle(ActionEvent e) {
                borderPane.setBackground(yellowColortBG);
            }
        });
        bgGradientRadio.setOnAction(new EventHandler<ActionEvent>() {
            @Override public void handle(ActionEvent e) {
                borderPane.setBackground(yellowGradientBG);
            }
        });
        
        borderPane.setBackground(yellowGradientBG);               
        
        final HBox radioBox = new HBox();
        radioBox.setSpacing(10);

        radioBox.getChildren().addAll(bgColorRadio, bgGradientRadio);
                   
        borderPane.setCenter(subScene);
        borderPane.setBottom(radioBox);

        final Scene scene = new Scene(borderPane, 900, 900, true);       
       
        stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
            @Override public void handle(WindowEvent event) {
                System.exit(0); 
            }
        });
        stage.setScene(scene);    
        stage.setTitle("BackgroundFillBlending");
        
        stage.show();  
        
        cylRotTransition.play();
    }
}
Comments
Yes, this is already fixed.
30-09-2013

Probably a duplicate of RT-31110
16-07-2013

b96: same behavior b97: can't be reproduced; fixed ?
12-07-2013