docs: @Override
      public ImageSource apply(ImageSource input) {
          if (input.isGrayscale()) {
              return input;
          }
          if (!isAlgorithm) {
              double r, g, b, gray;
  
              for (int i = 0; i < EffectHelper.getSize(input); i++) {
                  r = EffectHelper.getRed(i, input);
                  g = EffectHelper.getGreen(i, input);
                  b = EffectHelper.getBlue(i, input);
                  int a = EffectHelper.getAlpha(i, input);
  
                  gray = (r * redCoefficient + g * greenCoefficient + b * blueCoefficient);
  
                  EffectHelper.setRGB(i, (int) gray, (int) gray, (int) gray, a, input);
              }
              return input;
          } else {
              return apply(input, grayscaleMethod);
          }
      }