picasso-transformations
picasso-transformations copied to clipboard
TritoneTransformation
There is an issue with the TritoneTransformation.
The member lut is never initialised and is called on the filterRGB(int x, int y, int rgb) method, throwing a NullPointerException.
Hello dwbrito,
Please remove the filter method and put the below method in TritoneTransformation.java . now it will work fine.
@Override
public Bitmap transform(Bitmap src) {
lut = new int[256];
for (int i = 0; i < 128; i++) {
float t = i / 127.0f;
lut[i] = ImageMath.mixColors(t, shadowColor, midColor);
}
for (int i = 128; i < 256; i++) {
float t = (i - 127) / 128.0f;
lut[i] = ImageMath.mixColors(t, midColor, highColor);
}
src = super.transform(src);
lut = null;
return src;
}
@dwbrito If you would you care to create a pull request for this, I will merge it in. Thanks!