我認爲你需要這個
void createImageArrays()
{
Bitmap bMap = BitmapFactory.decodeResource(getResources(), image);
Bitmap bMapScaled = Bitmap.createScaledBitmap(bMap, 240, 240, true);
bitmapsArray[0] = Bitmap.createBitmap(bMapScaled, 0, 0, 80, 80);
bitmapsArray[1] = Bitmap.createBitmap(bMapScaled, 80, 0, 80, 80);
bitmapsArray[2] = Bitmap.createBitmap(bMapScaled, 160, 0, 80, 80);
bitmapsArray[3] = Bitmap.createBitmap(bMapScaled, 0, 80, 80, 80);
bitmapsArray[4] = Bitmap.createBitmap(bMapScaled, 80, 80, 80, 80);
bitmapsArray[5] = Bitmap.createBitmap(bMapScaled, 160, 80, 80, 80);
bitmapsArray[6] = Bitmap.createBitmap(bMapScaled, 0, 160, 80, 80);
bitmapsArray[7] = Bitmap.createBitmap(bMapScaled, 80, 160, 80, 80);
bitmapsArray[8] = Bitmap.createBitmap(bMapScaled, 160, 160, 80, 80);
}
原始圖像是240x240,我把它分成9塊80×80
你想創建某種類型的瓷磚系統,或者您只是想要一次繪製圖像的不同部分。你用它做什麼? – 2011-01-21 03:07:33
我正在嘗試創建一個瓷磚系統。 我的想法是拆分圖像並將其添加到GridView中。 – Brandon 2011-01-21 03:18:18