I've seen code samples using matrix manipulation do to various stuff.
Example: ConvertToImage function in CoreSamples to save a PDF page as an image.
I have the code running and that is all ok.
What bothers me is that I have no clue what and more importantly why are matrices used how they are used.
Example (coming from ConvertToImage function):
Code: Select all
PXC_Matrix matrix = Page.GetMatrix(PXC_BoxType.PBox_PageBox);
// this part ??
matrix = auxInst.MathHelper.Matrix_Scale(ref matrix, cx / nWidth, -cy / nHeight);
matrix = auxInst.MathHelper.Matrix_Translate(ref matrix, 0, cy);
Page.DrawToIXCPage(ixcPage, ref rc, ref matrix, param);
Code: Select all
Page.GetDimension(out nWidth, out nHeight);
uint cx = (uint)(nWidth * 150 / 72.0);
uint cy = (uint)(nHeight * 150 / 72.0);
The part with a big "?" on top of my head is:
Code: Select all
matrix = auxInst.MathHelper.Matrix_Scale(ref matrix, cx / nWidth, -cy / nHeight);
matrix = auxInst.MathHelper.Matrix_Translate(ref matrix, 0, cy);
Further, there's even more complex code here: https://forum.pdf-xchange.com/viewtopic.php?f=66&t=30710&p=122842&hilit=Page_CreateEmpty#p122842
In that code, Matrix_Multiply is also used.
Is this (Matrices and how/when used) explained somewhere in detail?
-žarko