Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8128647

Effects broken on Scene with gradient background

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • fx2.0.2
    • javafx
    • Mac

      Test app below creates two stages one with a solid background scene and one with gradient. Both have some text with a drop shadow. The one with the gradient is all messed up, see attached pic.

      import javafx.application.Application;
      import javafx.geometry.Insets;
      import javafx.scene.Scene;
      import javafx.scene.effect.DropShadow;
      import javafx.scene.layout.StackPaneBuilder;
      import javafx.scene.paint.Color;
      import javafx.scene.paint.CycleMethod;
      import javafx.scene.paint.LinearGradient;
      import javafx.scene.paint.Stop;
      import javafx.scene.text.Font;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      /**
       * @author Jasper Potts
       */
      public class EffectBug extends Application {

          public static void main(String[] args) {
              Application.launch(args);
          }
          
          @Override public void start(Stage primaryStage) {
              // BROKEN
              {
                  Text label = new Text("Hello");
                  label.setFont(Font.font("Arial Black", 72));
                  label.setEffect(new DropShadow());
                  Scene scene = new Scene(
                          StackPaneBuilder.create().children(label).padding(new Insets(20)).build(),
                          new LinearGradient(0, 0, 0, 1, true, CycleMethod.REPEAT,
                              new Stop(0, Color.grayRgb(202)),
                              new Stop(1, Color.grayRgb(97))
                          ));
                  primaryStage.setScene(scene);
                  primaryStage.show();
              }
              
              // WORKING
              {
                  Text label = new Text("Hello");
                  label.setFont(Font.font("Arial Black", 72));
                  label.setEffect(new DropShadow());
                  Scene scene = new Scene(
                          StackPaneBuilder.create().children(label).padding(new Insets(20)).build(),
                          Color.YELLOW);
                  Stage secondaryStage = new Stage();
                  secondaryStage.setScene(scene);
                  secondaryStage.show();
              }
          }
      }

            flar Jim Graham
            jasper Jasper Potts (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: