如何使用ColorMatrix更改Bitmap的色温?

时间:2015-09-07 15:15:05

标签: android matrix colors bitmap colormatrix

如何更改位图的色温?

我尝试过在网上找到的这种方法:

 ColorMatrix colorMatrix = new ColorMatrix();

 colorMatrix.set(new float[] {
            temp/255.0f, 0, 0, 0, 0,
             0, temp/255.0f, 0, 0, 0
             0, 0, temp/255.0f, 0, 0,
             0, 0, 0, 1, 0}); 
// temp is the float i change with seekbar's progress
//i replace 255.0f with values from below's link!

http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html

1 个答案:

答案 0 :(得分:0)

你确定你不是在谈论ColorFilter吗?

Drawable drawable = new BitmapDrawable(bmp);
drawable.setColorFilter(warmColor, PorterDuff.Mode.MULTIPLY);