how to apply matrix on a different size bitmap

蹲街弑〆低调 提交于 2019-12-11 02:44:33

问题


i have 2 image views , the first imageview have bitmap with 600 px size second image view have 1024 px bitmap , and i am scaling rotating and moving first image view with matrix , once the user hit a button second image view should have the same size scale and rotation, but because the second imageview have a bigger bitmap i cannot just use

imageview2.setimagematrix(ImageView1Matrix)

it gives different results, is there anyway i can apply same operations(resize,rotate , translate) on the second imageview frim the first image view matrix?

iam currently trying this but only translate working, scale is not working and i dont know where to start to get the rotation value

 float[] values = new float[9];
           MIV1.getValues(values);


          a.setTranslate(values[Matrix.MTRANS_X], values[Matrix.MTRANS_Y]);
          */
         RectF r = new RectF(); 
          MIV1.mapRect(r);   

            RectF drawableRect = new RectF(0, 0, 1024, 1024);

            a.setRectToRect(drawableRect, r, Matrix.ScaleToFit.CENTER);
IV2.setImageMatrix(a);

来源:https://stackoverflow.com/questions/18426700/how-to-apply-matrix-on-a-different-size-bitmap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!