满意答案
yuj91ib56
2015.11.27
采纳率:40% 等级:12
已帮助:3056人
public Bitmap transparentImage(Bitmap bmp) {
int m_ImageWidth, m_ImageHeigth;
int m_ImageWidth = bmp.getWidth();
int m_ImageHeigth = bmp.getHeight();
int[] m_BmpPixel = new int[m_ImageWidth * m_ImageHeigth];
bmp.getPixels(m_BmpPixel, 0, m_ImageWidth, 0, 0, m_ImageWidth,
m_ImageHeigth);
for (int i = 0; i < m_ImageWidth * m_ImageHeigth; i++) {
if ((m_BmpPixel[i] & 0x00ffffff) == 0x00ff0000) {
m_BmpPixel[i] = 0x00000000;
}
}
bmp.setPixels(m_BmpPixel, 0, m_ImageWidth, 0, 0, m_ImageWidth,
m_ImageHeigth);
return bmp;
}
00分享举报