如何旋转的位图90度 [英] how to rotate a bitmap 90 degrees
本文介绍了如何旋转的位图90度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是Android上的发言 canvas.drawBitmap(visiblePage,0,0,油漆);
现在我想补充 canvas.rotate(90)
没有效果。 但是,如果我写的 canvas.rotate(90) canvas.drawBitmap(visiblePage,0,0,油漆); 我没有得到任何的位图绘制。 那我不这样做对吗?
解决方案
您也可以试试这个
矩阵矩阵=新的Matrix();
matrix.postRotate(90);
位图scaledBitmap = Bitmap.createScaledBitmap(bitmapOrg,宽度,高度,真);
位图rotatedBitmap = Bitmap.createBitmap(scaledBitmap,0,0,scaledBitmap .getWidth(),scaledBitmap .getHeight(),矩阵,真);
然后就可以使用旋转的图像在您的ImageView设置通过
imageView.setImageBitmap(rotatedBitmap);
here is the statement in android canvas.drawBitmap(visiblePage, 0, 0, paint);
Now I add canvas.rotate(90)
There is no effect. But if I write canvas.rotate(90) canvas.drawBitmap(visiblePage, 0, 0, paint); I get no bitmap drawn. So what am I not doing right?
解决方案
You can also try this one
Matrix matrix = new Matrix();
matrix.postRotate(90);
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmapOrg,width,height,true);
Bitmap rotatedBitmap = Bitmap.createBitmap(scaledBitmap , 0, 0, scaledBitmap .getWidth(), scaledBitmap .getHeight(), matrix, true);
Then you can use the rotated image to set in your imageview through
imageView.setImageBitmap(rotatedBitmap);
这篇关于如何旋转的位图90度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文