如何使用Matrix对bitmap的旋转与镜像水平垂直翻转
所属分类:
软件编程 / Android
阅读数:
1712
收藏 0赞 0分享
Bitmap convert(Bitmap a, int width, int height)
{
int w = a.getWidth();
int h = a.getHeight();
Bitmap newb = Bitmap.createBitmap(ww, wh, Config.ARGB_8888);// 创建一个新的和SRC长度宽度一样的位图
Canvas cv = new Canvas(newb);
Matrix m = new Matrix();
m.postScale(1, -1); //镜像垂直翻转
m.postScale(-1, 1); //镜像水平翻转
m.postRotate(-90); //旋转-90度
Bitmap new2 = Bitmap.createBitmap(a, 0, 0, w, h, m, true);
cv.drawBitmap(new2, new Rect(0, 0, new2.getWidth(), new2.getHeight()),new Rect(0, 0, ww, wh), null);
return newb;
}
TextView显示系统时间(时钟功能带秒针变化
用System.currentTimeMillis()可以获取系统当前的时间,我们可以开启一个线程,然后通过handler发消息,来实时的更新TextView上显示的系统时间,可以做一个时钟的功能
收藏 0赞 0分享
查看更多