Android - Matrix Pre, Post and Set methods
Matrix provide pre, post and set method for matrix transformation.
Pre and post are generally used to concatenate the existing Matrix value.
Set is used to overwrite the current matrix value with the existing ones.
But, please use Set method with care. It seems that Set methods will overwrite all the value in the 3x3 matrix. So, if you perform a postScale, then a setTranslate, the value set by postScale will be gone.
So, if you really want to set a translate with respect to x=0 and y=0, you can try the following
The following is trying to concat a scale, then perform a translation with respect to (0,0)
Matrix m = new Matrix();//do a scale and post concatm.postScale(2.0f, 2.0f);//get the existing 3x3 matrix valuesfloat mVal new float;m.getValues(mVal);// erase the current value before concat new valuem.postTranslate(-mVal[Matrix.MTRANS_X], 0);m.postTranslate(100.0f, 0);