Bitmap pen=bluePen;
int targetX=screenWidth/2;
int targetY=screenHeight/2;
int left=targetX-pen.getWidth()/2;
int right=targetX+pen.getWidth()/2;
int top=targetY;
int bottom=targetY+pen.getHeight();
RectF rectInScreenToWrapMyPencil=new RectF(left,top,right,bottom);
RectF pencilRect=new RectF(0,0,pen.getWidth(),pen.getHeight());
Matrix matrix=new Matrix();
matrix.mapRect(rectInScreenToWrapMyPencil,pencilRect);
matrix.setRotate(45);
canvas.drawBitmap(pen,matrix,null);
大家好,我想绘制一个可通过centerX()和屏幕顶部位置旋转的矩形位图,但是当我运行此代码时,位图被淹没并且可以旋转但在特定位置没有被淹没 有人可以告诉我如何解决吗?