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

Shaola Ren commented on PDFBOX-2117:
------------------------------------

Absolutely, for the radial shading, the color along the line passing the two 
centers of the two circles is stored. I have updated the code in my repository. 

I changed the hashmap to an array, and used an integer to indicate a RGB color 
value, to me, I prefer this version, however, you can decide whether to used 
this version or the previous one, I didn't deprecate the class ColorRGB now. 
Technically, I can use a 2D array to store the pixels' color instead of a 
hashmap in type 6&7 shading, but there are some other issues need to consider, 
like getting the image dimension, calculating a position shift when the shading 
area is only a small parts of the whole image. 

Some refactoring may possible to be done, which is a little bit dangerous, to 
me, I'd like to keep it as now. If have to, I'd like to do it at the very last 
as optimization of some other types shading is not done yet.

> AxialShadingContext is slow
> ---------------------------
>
>                 Key: PDFBOX-2117
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2117
>             Project: PDFBox
>          Issue Type: Sub-task
>          Components: Rendering
>            Reporter: Petr Slaby
>         Attachments: 000001_MTEXT_CS6.pdf, AxialShading.patch, 
> AxialShading1.patch, AxialShadingContext.java.getrgbimage, 
> GWG061_Shading_x1a.pdf, GWG061_Shading_x1a.pdf-1.png, 
> GWG061_Shading_x1a.pdf-1.png-diff.png, Shading2Function2.pdf, 
> Shading2Function2.ps, Shading2Function2text.pdf, asy-shade.pdf, 
> color_gradient.pdf, shading_pattern.pdf
>
>
> AxialShadingContext#getRaster() is on top of profiler hot spots in documents 
> that use an axial shading. Inside it, the slowest part is calling 
> PDColorSpaceRGB#toRGB() and PDFunctionType3#eval() (in this order).
>   



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to