About HPDF_Page_Concat()

54 views
Skip to first unread message

yeo3...@gmail.com

unread,
Dec 13, 2017, 3:44:39 AM12/13/17
to libHaru

I know that matrix concatenation is just multiplying 3*3 matrix RIGHT to the current matrix.

So, I thought that HPDF_Page_Concat(page,a,b,c,d,x,y) should do like below.












(Left matrix is current matrix, and right matrix is matrix to Concat. Matrix right to '=' is a result of HPDF_Page_Concat(page,a,b,c,d,x,y))

But using HPDF_Page_Concat(), I found that result of HPDF_Page_Concat() is different from multiplying matrix RIGHT.by current matrix.
I opened "src/hpdf_page_operator.c" file in libharu library folder and I found a code of HPDF_Page_Concat() .
At the end of HPDF_Page_Concat() I found this code.


















The value of (row3,column1) and (row3,column2) is not same to the result of matrix multiplication.
I think that last two statements before return need to be modified

from
attr->gstate->trans_matrix.x = tm.x + x * tm.a + y * tm.c;
to
attr->gstate->trans_matrix.x = x + tm.x * a + tm.y * c;
and from
attr->gstate->trans_matrix.y = tm.y + x * tm.b + y * tm.d;
to
attr->gstate->trans_matrix.y = y + tm.x * b + tm.y * d;

.

Adobe Illustrator scripting also provides matrix concatenation function: app.concatenateMatrix(Matrix M1,Matrix M2).
It works exactly multiplying M2 RIGHT to M1. So it returns the matrix M1*M2. But HPDF_Page_Concat() does not.

Is there a reason to implement HPDF_Page_Concat() like now?
Reply all
Reply to author
Forward
0 new messages