美文网首页
改变bitmap深色位置的颜色

改变bitmap深色位置的颜色

作者: 游侠_6fb7 | 来源:发表于2020-04-14 13:12 被阅读0次
private Bitmap drawCupBitmap(Bitmap bitmap, int desColor) {
        int w = bitmap.getWidth();
        int h = bitmap.getHeight();
        int array[] = new int[w * h];
        int n = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                int color = bitmap.getPixel(j, i);
                if (color != 0) {
                    color = desColor;
                }
                array[n] = color;
                n++;
            }
        }


        return bitmap = Bitmap.createBitmap(array, w, h,
                Bitmap.Config.ARGB_8888);
    }

相关文章

网友评论

      本文标题:改变bitmap深色位置的颜色

      本文链接:https://www.haomeiwen.com/subject/whwzmhtx.html