[ https://issues.apache.org/jira/browse/PDFBOX-1966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13924297#comment-13924297 ]
Tilman Hausherr edited comment on PDFBOX-1966 at 3/7/14 10:49 PM: ------------------------------------------------------------------ Thanks for the hint, especially because I am a big fan of the DRY principle. This code works for me and creates all the shaded images: {code} PDShadingPattern pdShadingPattern = new PDShadingPattern(); pdShadingPattern.setShading(shading); pdShadingPattern.setMatrix(ctm.createAffineTransform()); Paint paint = new PDPattern(null).toShadingPaint(pdShadingPattern, pageHeight); {code} Obviously, the PDPattern object does nothing except calling toShadingPaint(). The method does not use its own class - so I wonder, shouldn't I put the whole method in PDShading instead, and have ctm and pageHeight as parameter? Update: I tested it successfully with all my shading example files, the code is much shorter - any objections? Putting it all in PDShading has a good "lets take them home" feeling. was (Author: tilman): Thanks for the hint, especially because I am a big fan of the DRY principle. This code works for me and creates all the shaded images: {code} PDShadingPattern pdShadingPattern = new PDShadingPattern(); pdShadingPattern.setShading(shading); pdShadingPattern.setMatrix(ctm.createAffineTransform()); Paint paint = new PDPattern(null).toShadingPaint(pdShadingPattern, pageHeight); {code} Obviously, the PDPattern object does nothing except calling toShadingPaint(). The method does not use its own class - so I wonder, shouldn't I put the whole method in PDShading instead, and have ctm and pageHeight as parameter? Update: I'm testing it right now, the code is much shorter, and it works - any objections? Putting it all in PDShading has a good "lets take them home" feeling. > Type 1, 4 and 5 shadings for shFill() > ------------------------------------- > > Key: PDFBOX-1966 > URL: https://issues.apache.org/jira/browse/PDFBOX-1966 > Project: PDFBox > Issue Type: Bug > Components: Rendering > Affects Versions: 1.8.4, 2.0.0 > Reporter: Tilman Hausherr > Assignee: Tilman Hausherr > Priority: Minor > Labels: shading, shadingpattern > Fix For: 1.8.5, 2.0.0 > > Attachments: asy-functionshading.pdf, asy-functionshading.pdf-1.tif, > hsv-shading.pdf, hsv-shading.pdf-1.png > > Original Estimate: 5m > Remaining Estimate: 5m > > I found two images that didn't render properly. The reason is that the > appropriate code was missing in shFill() (the code is there for axial and > radial shading). I will fix this. -- This message was sent by Atlassian JIRA (v6.2#6252)