Rotate Bitmap
//package com.gaara.test.utils;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
class GraphicsUtils {
public static void rotateBitmap(Canvas canvas,Bitmap bitmap,float angle,int alpha,float scale) {
/* Matrix matrix = new Matrix();
matrix.setScale(4, 4);
Bitmap resizeBmp = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(),matrix, true);
matrix = new Matrix();
matrix.setTranslate(resizeBmp.getWidth()/2,resizeBmp.getHeight()/2);
matrix.preRotate(angle);
matrix.preTranslate(-resizeBmp.getWidth()/2,-resizeBmp.getHeight()/2);
matrix.postTranslate((canvas.getWidth()-resizeBmp.getWidth())/2,(canvas.getHeight()-resizeBmp.getHeight())/2);
Paint vPaint = new Paint();
vPaint.setStyle( Paint.Style.STROKE ); //???
vPaint.setAlpha(alpha); // Bitmap?????0 ~ 100)
canvas.drawBitmap(resizeBmp,matrix,vPaint);*/
Bitmap resizeBmp = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth()/2, bitmap.getHeight()/2);
canvas.drawBitmap(resizeBmp, 0,0,null);
}
}
Related examples in the same category