当前位置: 代码迷 >> Android >> android 改变bit地图颜色
  详细解决方案

android 改变bit地图颜色

热度:104   发布时间:2016-04-27 23:24:39.0
android 改变bitmap颜色


public static final Bitmap createRGBImage(Bitmap bitmap,int color)

{
int bitmap_w=bitmap.getWidth();
int bitmap_h=bitmap.getHeight();
int[] arrayColor=new int[bitmap_w*bitmap_h];
        int count=0;
        for(int i=0;i<bitmap_h;i++){
        for(int j=0;j<bitmap_w;j++){
        int color1=bitmap.getPixel(j,i);
       //这里也可以取出 R G B 可以扩展一下 做更多的处理,
       //暂时我只是要处理除了透明的颜色,改变其他的颜色
        if(color1!=0){
        }else{
        color1=color;
        }
        arrayColor[count]=color;
        count++;
        }
        }
    bitmap = Bitmap.createBitmap( arrayColor, bitmap_w, bitmap_h, Config.ARGB_4444 );
    return bitmap;

}

版权声明:本文为博主原创文章,未经博主允许不得转载。

  相关解决方案