我想逐渐将位图从一种颜色变为另一种颜色(所以好像它会从不那么红到逐渐变红。
我正在按像素执行此操作,但这会导致应用程序跳转,有人可以告诉我更有效的方法吗?
private void adjustCountryBitmapColor()
{
//TODO Possible memory leak in this method.
mAllPixels = new int [ mCountryBitmap.getHeight()* mCountryBitmap.getWidth()];
mCountryBitmap.getPixels(mAllPixels, 0, mCountryBitmap.getWidth(), 0, 0, mCountryBitmap.getWidth(),mCountryBitmap.getHeight());
/*
int alpha=argb>>24;
int red=(argb & 0x00FF0000)>>16;
int green=(argb & 0x0000FF00)>>8;
int blue=(argb & 0x000000FF);
*/
for(int i =0; i< mCountryBitmap.getHeight()*mCountryBitmap.getWidth(); i++)
{
if(mAllPixels[i]>>24 == -1)
{
/*AllPixels[i] == Color.BLACK)
{
mAllPixels[i] = Color.RED;
}
*/
mAllPixels[i] = Color.RED;
}
}
System.out.println(mDeltaOffSet);
//int alpha = mAllPixels[0]>>24;
//System.out.println(alpha);
mCountryBitmap.setPixels(mAllPixels, 0, mCountryBitmap.getWidth(), 0, 0, mCountryBitmap.getWidth(), mCountryBitmap.getHeight());
}