public Bitmap createReBitmap(int mWidth,int mHeight,Bitmap BG) {
int countX = (mWidth + BG.getWidth() - 1) / BG.getWidth();
int countY = (mHeight + BG.getHeight() - 1) / BG.getHeight();
Bitmap mBitmap= Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
Canvas canvas = new Canvas(mBitmap);
for(int idy = 0; idy < countY; ++ idy){
for(int idx = 0; idx < countX; ++ idx){
canvas.drawBitmap(BG, idx * BG.getWidth(), idy * BG.getHeight(), null);
}
}
return mBitmap;
}
android绘制背景平铺Bitmap图片
最新推荐文章于 2022-03-15 17:15:50 发布