# 问题小结（24）--获取已有图片的镜像图片

2013-04-02

[java]
public Bitmap convertBmp(Bitmap bmp){
int w = bmp.getWidth();
int h = bmp.getHeight();

Bitmap convertBmp = Bitmap.createBitmap(w, h, Config.ARGB_8888);// 创建一个新的和SRC长度宽度一样的位图
Canvas cv = new Canvas(convertBmp);
Matrix matrix = new Matrix();
matrix.postScale(1, -1); //镜像垂直翻转
// matrix.postScale(-1, 1); //镜像水平翻转
// matrix.postRotate(-90); //旋转-90度

Bitmap newBmp = Bitmap.createBitmap(bmp, 0, 0, w, h, matrix, true);
cv.drawBitmap(newBmp, new Rect(0, 0,newBmp.getWidth(), newBmp.getHeight()),new Rect(0, 0, w, h), null);
return convertBmp;
}

public Bitmap convertBmp(Bitmap bmp){
int w = bmp.getWidth();
int h = bmp.getHeight();

Bitmap convertBmp = Bitmap.createBitmap(w, h, Config.ARGB_8888);// 创建一个新的和SRC长度宽度一样的位图
Canvas cv = new Canvas(convertBmp);
Matrix matrix = new Matrix();
matrix.postScale(1, -1); //镜像垂直翻转
// matrix.postScale(-1, 1); //镜像水平翻转
// matrix.postRotate(-90); //旋转-90度

Bitmap newBmp = Bitmap.createBitmap(bmp, 0, 0, w, h, matrix, true);
cv.drawBitmap(newBmp, new Rect(0, 0,newBmp.getWidth(), newBmp.getHeight()),new Rect(0, 0, w, h), null);
return convertBmp;
}