我一直在寻找解决此问题的解决方案,但是没有任何帮助,甚至是这里的答案。文档也没有解释任何内容。
我只是试图使旋转方向朝另一个对象的方向。问题在于位图不是围绕固定点旋转,而是围绕位图(0,0)旋转。
这是我遇到麻烦的代码:
Matrix mtx = new Matrix();
mtx.reset();
mtx.preTranslate(-centerX, -centerY);
mtx.setRotate((float)direction, -centerX, -centerY);
mtx.postTranslate(pivotX, pivotY);
Bitmap rotatedBMP = Bitmap.createBitmap(bitmap, 0, 0, spriteWidth, spriteHeight, mtx, true);
this.bitmap = rotatedBMP;
奇怪的是,无论如何更改pre/中的值postTranslate()以及中的float参数,都没有关系setRotation()。有人可以帮忙,把我推向正确的方向吗?:)
哔哔one
幕布斯6054654
墨色风雨
相关分类