ssimms / pdfapi2

Create, modify, and examine PDF files in Perl
Other
15 stars 20 forks source link

PDF::API2::Content::matrix property purpose #66

Open cl0ne opened 1 year ago

cl0ne commented 1 year ago

Greetings!

Private matrix field is never used (neither written to nor read from) https://github.com/ssimms/pdfapi2/blob/0f602e0eec825f54deacb1ecff1d6d9c5e4f8031/lib/PDF/API2/Content.pm#L52 and in matrix property we return $self for graphics objects: https://github.com/ssimms/pdfapi2/blob/0f602e0eec825f54deacb1ecff1d6d9c5e4f8031/lib/PDF/API2/Content.pm#L316-L336 Shouldn't we store changes to the graphics state matrix in the aforementioned private field and return it from matrix accessor?

ssimms commented 11 months ago

It's possible, but it could very easily become a bug factory without a clear benefit. The current matrix method is write-only, and suggests that you use transform unless you particularly need to pass a low-level matrix.

Do you have a use case for reading the matrix that can't be accomplished by the existing transformation methods?

cl0ne commented 9 months ago

Hi! Currently, I can't remember why I was looking into this part of the code. Probably I was debugging my own code. But I spotted the inconsistency in the behavior and an unused field, so I decided to ask if this as intended and what is the intent.