JDK-8162796 : [macosx] LinearGradientPaint and RadialGradientPaint are not printed on OS X.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u4,8,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-07-29
  • Updated: 2018-10-19
  • Resolved: 2016-10-27
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 JDK 9
8u152Fixed 9 b144Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
Whilst investigating a JavaFX issue with gradient paint not being printed,
I noticed that even after my fix there, it was still not working on Mac.
It turns out that printing of LinearGradientPaint and RadialGradientPaint
have been broken on Mac, probably forever .. at least since Oracle
started shipping a JDK for OS X.

Attached test GradientPrintTest.java and resulting PDF show this.

Comments
For bug https://bugs.openjdk.java.net/browse/JDK-8142394 , the area of content is darker than the title in the printed page,we have verified this issues. On Mac10.12 with JDK9b181,no thus issues On Mac10.12 with JDK9.0.3b09,no thus issues On Mac10.12 with JDK8u152b15,failed the same as the bug.
14-09-2017

P2 must-fix
25-10-2016

This is a must-fix for 9 and needs an 8u backport. If it needs to be a P2 it can be ..
25-10-2016

LinearGradientPaint printing is not effected because in QuartzSurfaceData.m#CompleteCGContext contextTexturePath() is commented out. http://hg.openjdk.java.net/jdk9/client/jdk/file/ccc7d013fd4e/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.m#l1083 For normal gradientPaint, CompleteCGContext() is called with renderType = SD_Shade which calls contextGradientPath() which works ok. whereas for lineargradientpaint, CompleteCGContext() is called with renderType = SD_Pattern If we uncomment contextTexturePath(), there is a crash in ImageSurfaceData.m#LockImage when it tries to access isdo->javaImageInfo[sun_java2d_OSXOffScreenSurfaceData_kImageStolenIndex]
15-09-2016

This is deferred as non-reg-9 , nevertheless you can fix it in 9, in such case please re-target right before your fix push
09-09-2016

There is the same issue happened on Mac10.12-Beta-x64-jdk8u102b14-64bit. RULE "test/manual/printing/PasswordField.java" any any RULE "test/manual/printing/TextArea.java" any any RULE "test/manual/printing/TextField.java" any any RULE "test/manual/printing/TitledPane.java" any any RULE "test/manual/printing/ToolBar.java" any any
26-08-2016

There's the same issue happened on Mac10.11-x64 with JDK8u112b09-64bit RULE "test/manual/printing/PasswordField.java" any any RULE "test/manual/printing/TextArea.java" any any RULE "test/manual/printing/TextField.java" any any RULE "test/manual/printing/TitledPane.java" any any RULE "test/manual/printing/ToolBar.java" any any
24-08-2016

There is the same issue happened on Win7-x86+jdk8u111b09-32bit. RULE "test/manual/printing/TextArea.java" any any RULE "test/manual/printing/PasswordField.java" any any RULE "test/manual/printing/TextField.java" any any RULE "test/manual/printing/TitledPane.java" any any RULE "test/manual/printing/ToolBar.java" any any
19-08-2016

It would be good to attempt at least a LinearGradientPaint fix in 9...
12-08-2016

This has actually been reported before. See https://bugs.openjdk.java.net/browse/JDK-8080134 which mentions TexturePaint and LinearGradientPaint but not RadialGradientPaint. That was closed as a dup. of https://bugs.openjdk.java.net/browse/JDK-8040635 which was originally only about TexturePaint The fixes may not be different depending on what we can do through Quartz so I will keep this one open. Also this came up again in FX printing : https://bugs.openjdk.java.net/browse/JDK-8142394
12-08-2016

Definetly fails on JDK7u - I reproduced on 7u40. It did work in Apple JDK 6u65 however .. I don't see in the Quartz code used for printing anything that looks like an explicit handling of these cases. gradients are handled but that seems like it may be for GradientPaint. So this may need some new code to be written.
29-07-2016