Well, maybe it's designed to be that way, but most people won't expect
the current setup.

Please do make the Documentation clearer, of the actual effect, "RESET
the entire matrix, to Identity scaled by Sx and Sy".
And add the follwing: "Warning: Any previous Matrix info, will be
lost."

On 13 abr, 00:38, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> This is normal and expected, but the docs should be clearer.
> setScale/setTranslate/etc. on Matrix set the Matrix to the specified
> transformation. To compose the transformation with the existing Matrix
> you need to use the pre/post methods.
>
>
>
> On Sat, Apr 12, 2008 at 3:18 PM, Rui Martins <[EMAIL PROTECTED]> wrote:
>
> >  The following Code works, and does what we expect:
>
> >         android.graphics.Matrix myMatrix = new android.graphics.Matrix();
> >         myMatrix.reset();
> >         myMatrix.setScale( 1, 1 );
> >         myMatrix.preTranslate( 100.0f, 36.5f );
>
> >  This code, DOES NOT work, i.e. does NOT do what we expect
> >         android.graphics.Matrix myMatrix = new android.graphics.Matrix();
> >         myMatrix.reset();
> >         myMatrix.preTranslate( 100.0f, 36.5f );
> >         myMatrix.setScale( 1, 1 );
>
> >  I was able to spot the problem, because I was using myMatrix, to calc
> >  an animation step, so small variations are easilly detectable, if they
> >  don't occur.
>
> >  The Documentation states:
>
> >         public void setScale(float sx, float sy)
> >         Set the matrix to scale by sx and sy.
>
> >  But Matrix setScale(...) method, is doing more than it should, i.e.
> >  it's resetting the matrix translation parameters too, so any previous
> >  translation info is lost.
>
> >  If we setScale(...) first and translate later, it works, because we
> >  add the translation after the scale.
>
> >  However if we use preScale(...) or postScale(...) it works always as
> >  expected. Although it's ane ntirelly different operation, since if the
> >  matrix is already scaled, it will increase the scaling by Sx and Sy
> >  factor.
>
> >  Apparently, the setScale(...), is resetting the matrix translation
> >  parameters, most probably is doing something similar to setting the
> >  Matrix to identity, and then set scale (Sx and Sy), i.e. it's probably
> >  rewriting the entire matrix.
>
> >  This is NOT stated anywhere in the docs, and besides, is not what
> >  anyone would expect!
>
> >  setScale(...) should only change the Sx and Sy parameters of the
> >  Matrix, and leave the rest of the matrix untouched.
>
> >  Hope someone from google will confirm this.
>
> >  NOTE1: This is on M3. Haven't checked on M5
> >  NOTE2: There is another Matrix class in android.opengl.Matrix, maybe
> >  it's scaleM(...) matrix, also has this problem, haven't checked
> >  though.
>
> --
> Romain Guywww.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to