68分!在线等bitmap中心点旋转问题~~~
活着便精彩 2011-04-26 02:04:26 现在有一张图 200*100, left和top都是100。
现在我要把这张图按照中心点旋转,但是不行
Matrix mMatrix=new Matrix()
mMatrix.reset();
/* 设置旋转 */
if(tempwidth==0){
mMatrix.preRotate(Angle,100+BitQQwidth/2,100+BitQQheight/2);}
else{
mMatrix.preRotate(Angle,100+tempwidth/2,100+tempheight/2);
}
Bitmap mBitQQ2;
/* 按mMatrix得旋转构建新的Bitmap */
if(flag==0)
mBitQQ2 = Bitmap.createBitmap(mBitQQ, 0, 0, BitQQwidth,BitQQheight, mMatrix, true);
else
mBitQQ2 = Bitmap.createBitmap(mBitQQ, 0, 0, tempwidth,tempheight, mMatrix, true);
tempwidth=mBitQQ2.getWidth();
tempheight=mBitQQ2.getHeight();
/* 绘制旋转之后的图片 */
GameView.drawImage(canvas, mBitQQ2, 100, 100);
这样不是以中心点对齐的
谁给个例子 或者说下怎么做啊 中心点px,py写错了?