2012-04-18 38 views

回答

2

函数提取从图像中你需要下面的代码

import android.graphics.Color; 

    int[] pixels = new int[myBitmap.getHeight()*myBitmap.getWidth()]; 
    myBitmap.getPixels(pixels, 0, myBitmap.getWidth(), 0, 0, myBitmap.getWidth(), myBitmap.getHeight()); 
    for (int i=0; i<myBitmap.getWidth()*5; i++) 
     pixels[i] = Color.BLUE; 
    myBitmap.setPixels(pixels, 0, myBitmap.getWidth(), 0, 0, myBitmap.getWidth(), myBitmap.getHeight()); 
信息
0

将图像加载到位图。然而,像

Bitmap b = ... 
int color = b.getPixel(x,y); 
b.setPixel(x, y, color);