Android Open Source - android-imgpro-lib Brightness






From Project

Back to project page android-imgpro-lib.

License

The source code is released under:

MIT License

If you think the Android project android-imgpro-lib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.akhyar.android.imgpro.actions;
/* w  w  w .jav a2 s .c  om*/
import net.akhyar.android.imgpro.Action;

public class Brightness extends Action {

  private int offset;

  public Brightness(int offset) {
    this.offset = offset;
  }

  @Override
  protected void adjustPixels(int[] pixels) {
    int r, g, b;

    int[] cache = new int[256];
    for (int i = 0; i < cache.length; i++) {
      cache[i] = clamp(i + offset);
    }

    for (int i = 0; i < pixels.length; i++) {
      r = cache[0xff & (pixels[i] >> 16)];
      g = cache[0xff & (pixels[i] >> 8)];
      b = cache[0xff & (pixels[i])];

      pixels[i] = 0xff000000 + (r << 16) + (g << 8) + b;
    }
  }

  public float getOffset() {
    return offset;
  }

  public void setOffset(int offset) {
    this.offset = offset;
  }

}




Java Source Code List

net.akhyar.android.imgpro.Action.java
net.akhyar.android.imgpro.Channel.java
net.akhyar.android.imgpro.FilterListener.java
net.akhyar.android.imgpro.FilterTask.java
net.akhyar.android.imgpro.Filter.java
net.akhyar.android.imgpro.ImgPro.java
net.akhyar.android.imgpro.actions.Blend.java
net.akhyar.android.imgpro.actions.Blur.java
net.akhyar.android.imgpro.actions.Brightness.java
net.akhyar.android.imgpro.actions.ChannelMix.java
net.akhyar.android.imgpro.actions.Colorize.java
net.akhyar.android.imgpro.actions.Contrast.java
net.akhyar.android.imgpro.actions.Desaturate.java
net.akhyar.android.imgpro.actions.Invert.java
net.akhyar.android.imgpro.filters.Default.java
net.akhyar.android.imgpro.filters.Vintage.java
net.akhyar.android.imgpro.filters.XProcess.java
net.akhyar.android.perf.BitmapTask.java
net.akhyar.android.perf.SetBitmap.java
net.akhyar.android.perf.SetImageViewBitmapTask.java
net.akhyar.android.perf.Worker.java