@Override
 public boolean equals(FilterRepresentation representation) {
   if (representation instanceof FilterGradRepresentation) {
     FilterGradRepresentation rep = (FilterGradRepresentation) representation;
     int n = getNumberOfBands();
     if (rep.getNumberOfBands() != n) {
       return false;
     }
     for (int i = 0; i < mBands.size(); i++) {
       Band b1 = mBands.get(i);
       Band b2 = rep.mBands.get(i);
       if (b1.mask != b2.mask
           || b1.brightness != b2.brightness
           || b1.contrast != b2.contrast
           || b1.saturation != b2.saturation
           || b1.xPos1 != b2.xPos1
           || b1.xPos2 != b2.xPos2
           || b1.yPos1 != b2.yPos1
           || b1.yPos2 != b2.yPos2) {
         return false;
       }
     }
     return true;
   }
   return false;
 }
Exemplo n.º 2
0
  @Override
  protected void runFilter() {
    int[] x1 = mParameters.getXPos1();
    int[] y1 = mParameters.getYPos1();
    int[] x2 = mParameters.getXPos2();
    int[] y2 = mParameters.getYPos2();

    int width = getInPixelsAllocation().getType().getX();
    int height = getInPixelsAllocation().getType().getY();
    Matrix m = getOriginalToScreenMatrix(width, height);
    float[] coord = new float[2];
    for (int i = 0; i < x1.length; i++) {
      coord[0] = x1[i];
      coord[1] = y1[i];
      m.mapPoints(coord);
      x1[i] = (int) coord[0];
      y1[i] = (int) coord[1];
      coord[0] = x2[i];
      coord[1] = y2[i];
      m.mapPoints(coord);
      x2[i] = (int) coord[0];
      y2[i] = (int) coord[1];
    }

    mScript.set_mask(mParameters.getMask());
    mScript.set_xPos1(x1);
    mScript.set_yPos1(y1);
    mScript.set_xPos2(x2);
    mScript.set_yPos2(y2);

    mScript.set_brightness(mParameters.getBrightness());
    mScript.set_contrast(mParameters.getContrast());
    mScript.set_saturation(mParameters.getSaturation());

    mScript.invoke_setupGradParams();
    runSelectiveAdjust(getInPixelsAllocation(), getOutPixelsAllocation());
  }