I have an android app in which I am increasing brightness of image with the code below. But this is very slow so does anyone knows a fast way to enhance image brightness of
I can't exactly remember where i got this from but i use this (with negative value to get something darker, put some positive value to get something bright)
drawable.setColorFilter(applyLightness(-30));
public static PorterDuffColorFilter applyLightness(int progress)
{
if (progress > 0)
{
int value = (int) progress * 255 / 100;
return new PorterDuffColorFilter(Color.argb(value, 255, 255, 255), Mode.SRC_OVER);
}
else
{
int value = (int) (progress * -1) * 255 / 100;
return new PorterDuffColorFilter(Color.argb(value, 0, 0, 0), Mode.SRC_ATOP);
}
}
edit : found where i took this from : Adjusting Lightness using ColorMatrix