读书人

背景map的构建(1)

发布时间: 2014-01-23 14:48:04 作者: rapoo

背景地图的构建(1)
public static Bitmap resizeBitmap(Bitmap bitmap, int w, int h) {if (bitmap != null) {int width = bitmap.getWidth();int height = bitmap.getHeight();int newWidth = w;int newHeight = h;float scaleWidth = ((float) newWidth) / width;float scaleHeight = ((float) newHeight) / height;Matrix matrix = new Matrix();//矩阵映射matrix.postScale(scaleWidth, scaleHeight);Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, width,height, matrix, true);return resizedBitmap;} else {return null;}}

? ? ? ? ? ? ? ?5.得到Canvas画布,利用Canvas.drawBitmap方法把图片画上去,这样就能得到合适的图片了? ? ? ? ? ? ?

?

?

?

读书人网 >移动开发

热点推荐