how to use the LightingColorFilter to make the image form dark to light

前端 未结 2 1776
长发绾君心
长发绾君心 2020-12-13 16:16

I want to add light of the image, I want to use LightingColorFilter

LightingColorFilter lcf = new LightingColorFilter( mul, add); 
imageView.set         


        
2条回答
  •  無奈伤痛
    2020-12-13 16:39

    Canvas canvas= new Canvas(my_bitmap); // create canvas from bitmap
    Paint my_paint = new Paint(); // create Paint from bitmap
    
    my_paint.setColorFilter(new LightingColorFilter(0x77777777, 0x77777777));//(mul, add)
    
    canvas.drawBitmap(my_bitmap, 0, 0, my_paint );
    

    1- now you can show my_bitmap

    2- now my_bitmap have about 50% more light

    3- you can change (mul, add) to understand how work

    4- also can use my_paint in other graphic method

提交回复
热议问题