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

Printing of LinearGradient fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8u31
    • javafx

      Printing a rectangle with a linear gradient as fill does only use the first color of the gradient to fill the complete rectangle with. Here is a test case:

      {code}
      public class PrintGradientTest extends Application {
        @Override
        public void start(Stage primaryStage) throws Exception {
          Stop[] stops = new Stop[]{new Stop(0, Color.BLUE), new Stop(1, Color.WHITE)};
          Paint gradient = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);

          Rectangle rect = new Rectangle(100, 200);
          rect.setFill(gradient);

          Group root = new Group(rect);
          primaryStage.setScene(new Scene(root));
          primaryStage.show();

          PrinterJob job = PrinterJob.createPrinterJob();
          if (job.showPrintDialog(primaryStage)) {
            boolean success = job.printPage(root);
            if (success) {
              job.endJob();
            }
          }
        }
      }
      {code}

            prr Philip Race
            duke J. Duke
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: