I am currently trying to port the following Java or Swift code in C# (in a Windows Phone library) :
Here the Java code :
public Matrix zoom(float scaleX, float scaleY, float x, float y)
{
final Matrix save = new Matrix();
save.set(anotherMatrix);
save.postScale(scaleX, scaleY, x, y);
return save;
}
And here the Swift code :
public func zoom(#scaleX: CGFloat, scaleY: CGFloat, x: CGFloat, y: CGFloat) -> CGAffineTransform
{
var matrix = CGAffineTransformTranslate(_touchMatrix, x, y);
matrix = CGAffineTransformScale(matrix, scaleX, scaleY);
matrix = CGAffineTransformTranslate(matrix, -x, -y);
return matrix;
}
Basically, in C# for Windows Phone I have the following classes :
System.Windows.Media.Matrix
System.Windows.Media.TranslateTransform
System.Windows.Media.ScaleTransform
But... the Transform
method of the TranslateTransform
and ScaleTransform
classes work with Point
and not with Matrix
.
How can I apply scale and translate transformation to a matrix in C# ?