public Bitmap createCanNotRecycleBitmap(Bitmap bitmap) { int fgWidth = bitmap.getWidth(); int fgHeight = bitmap.getHeight(); //create the new blank bitmap 创建一个新的和SRC长度宽度一样的位图 Bitmap newbmp = Bitmap.createBitmap(fgWidth, fgHeight, Bitmap.Config.ARGB_8888); Canvas cv = new Canvas(newbmp); //draw fg into cv.drawBitmap(bitmap, new Rect(0,0,fgWidth,fgHeight), new Rect(0,0,fgWidth,fgHeight), null);//在 0,0坐标开始画入fg ,可以从任意位置画入 //save all clip cv.save(Canvas.ALL_SAVE_FLAG);//保存 //store cv.restore();//存储 return newbmp;}
时间: 2024-10-06 00:07:46