1. Zoom
/**
* Zoom bitmap to certain size
*
* @ Param bitmap
* @ Param width
* @ Param height
* @ Return
*/
Public static Bitmap zoomBitmap (Bitmap bitmap, int width, int height ){
If (bitmap = null ){
Return null;
}
Int w = bitmap. getWidth ();
Int h = bitmap. getHeight ();
Matrix matrix = new Matrix ();
Float scaleWidth = (float) width/w );
Float scaleHeight = (float) height/h );
Matrix. postScale (scaleWidth, scaleHeight );
Bitmap newbmp = Bitmap. createBitmap (bitmap, 0, 0, w, h, matrix, true );
Return newbmp;
}
2. Shadow
/**
* Add shadow to bitmap
*
* @ Param originalBitmap
* @ Return
*/
Private Bitmap drawImageDropShadow (Bitmap originalBitmap ){
BlurMaskFilter blurFilter = new BlurMaskFilter (1,
BlurMaskFilter. Blur. NORMAL );
Paint shadowPaint = new Paint ();
ShadowPaint. setAlpha (50 );
ShadowPaint. setColor (activity. getResources ()
. GetColor (R. color. solid_red ));
ShadowPaint. setMaskFilter (blurFilter );
Int [] offsetXY = new int [2];
Bitmap shadowBitmap = originalBitmap
. ExtractAlpha (shadowPaint, offsetXY );
Bitmap shadowImage32 = shadowBitmap. copy (Bitmap. Config. ARGB_8888, true );
Canvas c = new Canvas (shadowImage32 );
C. drawBitmap (originalBitmap, offsetXY [0], offsetXY [1], null );
Return shadowImage32;
}
From fhy_2008