Antigranitic geometry uses the basic method to determine the scaling of a transform (an implementation is found in agg_trans_affine.cpp). This is done like this:
- Conversion rotation calculation
- Transform duplication and reverse rotation
- Convert two known points and calculate the scale from the result
Translated to C #, it looks like this:
Matrix transform = (Matrix)graphics.Transform.Clone();
PointF[] rotationPoints = new PointF[] { new PointF(0, 0), new PointF(1, 0) };
transform.TransformPoints(rotationPoints);
double rotationRadians = Math.Atan2(rotationPoints[1].Y - rotationPoints[0].Y, rotationPoints[1].X - rotationPoints[0].X);
transform.Rotate((float)(-rotationRadians * (180.0 / Math.PI)));
PointF[] scalePoints = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
transform.TransformPoints(scalePoints);
float xScale = scalePoints[1].X - scalePoints[0].X;
float yScale = scalePoints[1].Y - scalePoints[0].Y;
AGG , , , .