只显示三成的图像
private Bitmap createBitmap( Bitmap src)
{
boolean isPortrait = mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
if( src == null )
{
return null;
}
int w = src.getWidth();
int h = src.getHeight();
Bitmap newb = Bitmap.createBitmap( w, h, Config.ARGB_8888 );
Canvas cv = new Canvas( newb );
if(isPortrait){
final Rect rect = new Rect(0, 0, w, (int)(h*0.3));
final Rect rect2 = new Rect(0, 0, w, (int)(h*0.3));
cv.drawBitmap(src, rect, rect2, null);
}else
{
final Rect rect = new Rect(0, 0, (int)(w*0.3), h);
final Rect rect2 = new Rect(0, 0, (int)(w*0.3), h);
cv.drawBitmap(src, rect, rect2, null);
}
cv.save( Canvas.ALL_SAVE_FLAG );
cv.restore();
return newb;
}