Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TritoneTransformation #3

Open
ghost opened this issue Nov 11, 2014 · 2 comments
Open

TritoneTransformation #3

ghost opened this issue Nov 11, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 11, 2014

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.

@TheSikh
Copy link

TheSikh commented Dec 10, 2014

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;
}

@TannerPerrien
Copy link
Owner

@dwbrito If you would you care to create a pull request for this, I will merge it in. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants