我知道是什么意思,关键是我的程序中,width和height是大于0的啊。源码如下:
Matrix mtx=new Matrix();
degree=Math.toDegrees(Math.atan(yy/xx));
mtx.setRotate((float)degree, (float)x+bm.getWidth()/2, (float)y+bm.getHeight()/2);
Bitmap bm1=Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), mtx, false);//这句出错
canvas.drawBitmap(bm1,(float) x, (float)y, paint);
Matrix mtx=new Matrix();
degree=Math.toDegrees(Math.atan(yy/xx));
mtx.setRotate((float)degree, (float)x+bm.getWidth()/2, (float)y+bm.getHeight()/2);
Bitmap bm1=Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), mtx, false);//这句出错
canvas.drawBitmap(bm1,(float) x, (float)y, paint);
degree=Math.toDegrees(Math.abs(Math.atan(yy/xx)));
必须要有负数啊,没负数,atan取得值就不完整了。