Bitmap镜像

private Bitmap convertBitmap(Bitmap srcBitmap){
    int width = srcBitmap.getWidth();
    int height = srcBitmap.getHeight();
 
    Bitmap newBitmap = Bitmap.createBitmap(width,height, Bitmap.Config.ARGB_8888);
 
    Canvas canvas = new Canvas();
    Matrix matrix = new Matrix();
 
    matrix.postScale(-1,1);
 
    Bitmap newBitmap2 = Bitmap.createBitmap(srcBitmap,0,0,width,height,matrix,true);
 
    canvas.drawBitmap(newBitmap2,
            new Rect(0,0,width,height),
            new Rect(0,0,width,height),null);
 
    return newBitmap2;
 
}

你可能感兴趣的:(Bitmap镜像)