How to translate a matrix to move a draw to x pixel on the right?


in Delphi firemonkey, in the onpaint Event, I would like to offset all the draw on the canvas of say 20px on the right. How to set the matrix that I will use with Canvas.SetMatrix(aMatrix) ?

This is an example for rotation (but here I don’t want rotation, just offset on the right) :

aMatrixRotationCenter.X := (width / 2) + Canvas.Matrix.m31;
aMatrixRotationCenter.Y := (height / 2) + Canvas.Matrix.m32;
aMatrix := Canvas.Matrix;
aMatrix := aMatrix * TMatrix.CreateTranslation(-aMatrixRotationCenter.X,-aMatrixRotationCenter.Y);
aMatrix := aMatrix * TMatrix.CreateRotation(DegToRad(-25));
aMatrix := aMatrix * TMatrix.CreateTranslation(aMatrixRotationCenter.X,aMatrixRotationCenter.Y);

Comments are closed.