Exemplo n.º 1
0
 /**
  * Creates an {@link AbstractChannelFilterOperation} that computes the logical-XOR of the given
  * constant pixel value and the applied {@link Image}.
  *
  * @param pixel the constant pixel value to XOR with the applied {@link Image}
  * @return an {@link AbstractChannelFilterOperation} that computes the logical-XOR of the given
  *     constant pixel value and the applied {@link Image}
  */
 public static AbstractChannelFilterOperation getXorOperation(final int pixel) {
   final int[] constant = Color.getPixelRGBA(pixel);
   return new AbstractChannelFilterOperation() {
     @Override
     protected int processChannel(int v, int x, int y, int i, Image input) {
       return v ^ constant[i];
     }
   };
 }
Exemplo n.º 2
0
 /**
  * Creates an {@link AbstractChannelFilterOperation} that computes the sum of the given constant
  * pixel value and the applied {@link Image}.
  *
  * @param pixelOffset
  * @return an {@link AbstractChannelFilterOperation} that computes the sum of the given constant
  *     pixel value and the applied {@link Image}
  */
 public static AbstractChannelFilterOperation getAddOperation(final int pixelOffset) {
   final int[] argbOffset = Color.getPixelRGBA(pixelOffset);
   return new AbstractChannelFilterOperation() {
     @Override
     protected int processChannel(int v, int x, int y, int i, Image input) {
       return v + argbOffset[i];
     }
   };
 }
Exemplo n.º 3
0
 /**
  * Creates an {@link AbstractChannelFilterOperation} that computes the absolute difference of the
  * given constant pixel value and the applied {@link Image}.
  *
  * @param pixelOther
  * @return an {@link AbstractChannelFilterOperation} that computes the absolute difference of the
  *     given constant pixel value and the applied {@link Image}
  */
 public static AbstractChannelFilterOperation getAbsDifferenceOperation(final int pixelOther) {
   final int[] argbOther = Color.getPixelRGBA(pixelOther);
   return new AbstractChannelFilterOperation() {
     @Override
     protected int processChannel(int v, int x, int y, int i, Image input) {
       return Math.abs(v - argbOther[i]);
     }
   };
 }