将位图放置在动态壁纸中
您好,我正在尝试在屏幕上放置几个位图并旋转它们。 来使其工作
canvas.drawBitmap(pic2, rotatePic, null);
我可以通过执行rotatePic
is matrix
postRotate(5, pic2.getHieght()/2, pic2.getWidth()/2)
,这样可以旋转图片并将其放置在 0, 0
处,这样我尝试放置它
Bitmap topPic = Bitmap.createBitmap(pic2, 0, 0, pic2.getWidth(),
pic2.getHeight(), rotatePic, false);
而不是放置
canvas.drawBitmap(topPic, 200, 100, null);
它正确的位置但它不再正确旋转,看起来像是在弹跳和旋转 我已经尝试了一切
Hello I am trying to place acouple bitmaps on the screen and rotate them. I can get this to work by doing
canvas.drawBitmap(pic2, rotatePic, null);
rotatePic
is matrix with
postRotate(5, pic2.getHieght()/2, pic2.getWidth()/2)
this rotates the pic and puts it at 0, 0
so to place it i tried
Bitmap topPic = Bitmap.createBitmap(pic2, 0, 0, pic2.getWidth(),
pic2.getHeight(), rotatePic, false);
than place with
canvas.drawBitmap(topPic, 200, 100, null);
it places it correctley but it no longer rotates correctley it looks like it is bouncing and spinning I've tried everthing
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您也可以尝试旋转画布本身,使用
这里是 Android 参考页面的链接:
Canvas.rotate();
希望这有帮助!
You can alternatively try rotating the canvas itself, using
Here's a link to the Android reference page for this:
Canvas.rotate();
Hope this helps!!