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

Henry Iguaro commented on PDFBOX-5454:
--------------------------------------

Hi [~tilman] ,

Thank you for the quick response and apologies for the delay in answering this.


Answering your question:
{quote}We added showTransparencyGroupOnGraphics for you and now 7 months later, 
it turns out not to be what you needed?
{quote}

Unfortunately, yes. We should have started with a discussion of our use case, 
to get your advice on how to tackle the problem, instead of simply creating 
that PR 7 months ago, assuming that it would solve everything.

 

My goal is to render Transparency Groups as individual “layers” and, at the 
time, we were convinced that passing a graphics object reference of a new image 
was enough to draw the Transparency Group isolated from the main page graphics. 
It sounded like a good idea and we iterated and tested it with a significant 
corpus of files without noticing any artifacts. However, at some point we 
noticed artifacts in some PDFs, due to the problem mentioned in the description 
of this ticket.

 

I am happy to close both the ticket and the PR, but it would be awesome to get 
your advice. We are currently considering to copy, modify and maintain our own 
version of {{{}PageDrawer{}}}, as an alternative 
{{{}PDFGraphicsStreamEngine{}}}, such that we don’t pollute PdfBox. However, 
this doesn’t feel 100% right, either.

The JavaDoc on PageRenderer states:
{quote}“If you want to do custom graphics processing rather than {{Graphics2D}} 
rendering, then you should subclass {{{}{@link PDFGraphicsStreamEngine{}}}} 
instead. Subclassing {{PageDrawer}} is only suitable for cases where the goal 
is to render onto a {{Graphics2D}} surface.”
{quote}

We need exactly that: Rendering Transparency Groups on a separate 
{{Graphics2D}} surfaces, including nested Transparency Groups and/or soft masks.


On a high level, without going into details, and ignoring the approach 
suggested in my PR: Do you think this is functionality that should be part of 
'core PDFBox’' or do you think this is too specific, and should be part of a 
custom subclass of {{{}PDFGraphicsStreamEngine{}}}?


If the former, we would be happy to contribute, and help adding this 
functionality in a way that the PdfBox team is happy with.


Once again, I’m sorry about my mistakes, and really did not want to upset you. 
Happy to follow your suggestions and close both the ticket and the PR if you 
request so.


Thank you in advance for your time and consideration.


Regards,
Henry

> Add a setter for `PageDrawer.graphics` member variable
> ------------------------------------------------------
>
>                 Key: PDFBOX-5454
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5454
>             Project: PDFBox
>          Issue Type: New Feature
>          Components: Rendering
>    Affects Versions: 2.0.26
>            Reporter: Henry Iguaro
>            Priority: Trivial
>
> Hey folks! The following is a request to add a `protected` setter in 
> `PageDrawer` for the `graphics` member variable.
> The idea behind this change is to be able to draw the entirety of a 
> `TransparencyGroup` onto a separate image. We already tried using 
> `showTransparencyGroupOnGraphics()` but this doesn't work well with deeply 
> nested complex transparency groups (there are some areas that are drawn 
> incorrectly, are missed or misaligned).
> We set up a proof of concept that sets the parent graphics to the target 
> image through reflection and it worked.
> After the proof of concept we wondered if this could be included as a feature 
> to avoid any usage of reflection.
>  
> We created a PR for this here: [https://github.com/apache/pdfbox/pull/144]
>  
> Thank you in advance guys.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to