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}
{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}