Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 围绕一个角度旋转位图,并沿Pathmeasure移动它_Java_Android_Path_Bitmap_Rotation - Fatal编程技术网

Java 围绕一个角度旋转位图,并沿Pathmeasure移动它

Java 围绕一个角度旋转位图,并沿Pathmeasure移动它,java,android,path,bitmap,rotation,Java,Android,Path,Bitmap,Rotation,在我的应用程序中,我希望围绕传感器数据的一个角度旋转一个箭头,并沿路径移动它。现在我想在他的实际位置上旋转箭头/位图 我试过: Matrix mxTransform = new Matrix(); PathMeasure pm = new PathMeasure(pathMoveAlong, false); //walkedLength= moved distance pm.getMatrix(walkedLength, mxTransform,PathMeasure.POSITION_MATR

在我的应用程序中,我希望围绕传感器数据的一个角度旋转一个箭头,并沿
路径移动它。现在我想在他的实际位置上旋转箭头/位图

我试过:

Matrix mxTransform = new Matrix();
PathMeasure pm = new PathMeasure(pathMoveAlong, false);
//walkedLength= moved distance
pm.getMatrix(walkedLength, mxTransform,PathMeasure.POSITION_MATRIX_FLAG);
pm.getPosTan(walkedLength, pos, tan);
canvas.drawBitmap(bmImage, mxTransform, posPaint);

但是位图不会围绕预期位置旋转。

pm.getMatrix()
返回一个值,或者它使用了输出参数?它将我的PathMeasure中的移动变换矩阵写入我的矩阵MXTransform尝试在绘图之前粘贴一个断点,以确保你的
矩阵
包含正确的角度
mxTransform.setRotate(measuredAngle,pos[0],pos[1]);