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[9];m.getValues(mVal);// erase the current value before concat new valuem.postTranslate(-mVal[Matrix.MTRANS_X], 0);m.postTranslate(100.0f, 0);
thanks !
ReplyDeleteI am new to android.So any help is really a life saver for me.As you gave tip about set operation and shared the sample code.Thanks I was looking for same.
ReplyDeleteelectronic signatures
I am grad that it helps!! :)
ReplyDeleteldap online training| ldap training| call us+919000444287 ...
ReplyDeletewww.21cssindia.com/courses/ldap-online-training-103.html
LDAP Online Training, LDAP training, LDAP course contents, LDAP , call us: +919000444287,dharani@21cssindia.com.
I found Hubwit as a transparent s ite, a social hub which is a conglomerate of Buyers and Sellers who are ready to offer online digital consultancy at decent cost. Tubidy APK 2020 Download Free
ReplyDelete