[ 
https://issues.apache.org/jira/browse/PDFBOX-1966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13925101#comment-13925101
 ] 

John Hewson commented on PDFBOX-1966:
-------------------------------------

Yeah, I see why you are getting an  NPE, the *sh* operator is drawing a Shading 
directly instead of drawing it via a Pattern. That's somewhat awkward and 
doesn't fit nicely into the color space concept, as you've spotted a Shading is 
not always a Pattern.

Currently our various Paint subclasses in _org.apache.pdfbox.shading_ are all 
public, which I've realised they shouldn't be, as they are internal to PDFBox 
and not part of the public API. I didn't include any of the shading classes in 
my color space / drawing refactoring as they were undergoing active development 
(and still are).

Because a Shading is not necessarily a Pattern I agree with your original 
proposal to move toShadingPaint into PDShading because it is indeed possible to 
have an instance of Paint which does not come from a PDColorSpace and this is 
the most logical place for it to belong. This also gives me the opportunity to 
modify the visibility of the Paint and PaintContext subclasses to be private. 
I've done this in revision 1575655 by giving each of the PDShading subclasses 
an overloaded toPaint method (which is nice and DRY) and I've gone through each 
of the classes in _org.apache.pdfbox.shading_ and made them package-private 
where possible. Along the way I've standardised some of the naming and 
formatting to facilitate future refactoring, but I haven't made any functional 
changes, nor do I plan to.


> 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)

Reply via email to