android surfaceView 图片旋转问题

xuhuize xuhuize 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
class FreshThread implements Runnable {

@Override
public void run() {
int rotate = 0;
Paint paint = new Paint();
paint.setAntiAlias(true);
while (true) {
Canvas canvas = holder.lockCanvas(new Rect(0, 0, 300, 300));
canvas.drawColor(Color.BLACK);
try {
Matrix matrix = new Matrix();
matrix.setRotate((rotate += 30) % 360, (float) 189 / 2,
(float) 189 / 2);
Bitmap n = Bitmap.createBitmap(background, 0, 0, width,
hight, matrix, true);
canvas.drawBitmap(n, 0, 0, paint);
// canvas.drawBitmap(n, new Rect(0, 0, 200, 200), new
// Rect(0,
// 0, 200, 200), paint);
Thread.currentThread().sleep(1000);
} catch (Exception e) {
} finally {
holder.unlockCanvasAndPost(canvas);
}
}
}
}


就是我设置了图片旋转的原点之后 为什么图片旋转的同时还会从右下角向左上角来回移动呢???
...全文
评论 1
收藏 已收藏
分享
返回顶部
xuhuize
Android 80,489 成员 91,371 内容