68分!在线等bitmap中心点旋转问题~~~

活着便精彩 活着便精彩 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
现在有一张图 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写错了?
...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
活着便精彩
Android 80,490 成员 91,375 内容