专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Android

如何创建一个单色bitmap

发布时间:2010-05-30 10:52:14 文章来源:www.iduyao.cn 采编人员:星星草
怎么创建一个单色bitmap?
我想创建一个单色bitmap,然后再用这个bitmap创建一个BitmapDrawable...
那些函数的参数都不懂..谁有代码参考一下?
谢谢了~~纠结中.

------解决方案--------------------
全白
Java code
 int[] pix = new int[picw * pich];
               
        for (int y = 0; y < pich; y++)
              for (int x = 0; x < picw; x++)
                  {
                  int index = y * picw + x;
                  int r = ((pix[index] >> 16) & 0xff)|0xff;
                  int g = ((pix[index] >> 8) & 0xff)|0xff;
                  int b =( pix[index] & 0xff)|0xff;
                  pix[index] = 0xff000000 | (r << 16) | (g << 8) | b;
                  
                  }
        bm1.setPixels(pix, 0, picw, 0, 0, picw, pich);
        BitmapDrawable bmp11=new BitmapDrawable(bm1);
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: