1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
class Class1
{
//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;
//}
// Cette function est une serie de multiplication de Matrix AFFINES qui sont definies
// et GARANTIES COMME TELLES en WPF si on les "grabbe" à partir des TRANSFORMATIONS CORRESPONDANTES
private Matrix _touchMatrix;
public Matrix zoom(double scaleX, double scaleY ,double x, double y) //renvoi un matrix GARANTI AFFINE
{
//CGAffineTransformTranslate(_touchMatrix, x, y) multiple le matrix _touchMatrix par le matrix de Translation ...
TranslateTransform tt1 = new TranslateTransform(x,y);
Matrix matrix=_touchMatrix* tt1.Value;
ScaleTransform sc=new ScaleTransform(scaleX, scaleY);
matrix = matrix *sc.Value;
TranslateTransform tt2 = new TranslateTransform(-x,-y);
matrix =matrix*tt2.Value ;
return matrix;
}
} |
Partager