2010-11-17 5 views

Répondre

4

Utilisez une matrice:

int width = bitmap.getWidth(); 
int height = bitmap.getHeight(); 

float scaleWidth = ((float) newWidth)/width; 
float scaleHeight = ((float) newHeight)/height;  

matrix = new Matrix(); 

matrix.postScale(scaleWidth, scaleHeight); 

Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, 
        width, height, matrix, true); 
1

Ou Bitmap.createScaledBitmap(...)

Questions connexes