예제 #1
0
  public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
    BufferedImage dst = null; // ImageUtil.createBufferedImage(src);
    Object o;
    if ((o = parameters.removeEL(KeyImpl.init("Type"))) != null)
      setType(ImageFilterUtil.toString(o, "Type"));
    if ((o = parameters.removeEL(KeyImpl.init("EdgeAction"))) != null)
      setEdgeAction(ImageFilterUtil.toString(o, "EdgeAction"));
    if ((o = parameters.removeEL(KeyImpl.init("Interpolation"))) != null)
      setInterpolation(ImageFilterUtil.toString(o, "Interpolation"));

    // check for arguments not supported
    if (parameters.size() > 0) {
      throw new FunctionException(
          ThreadLocalPageContext.get(),
          "ImageFilter",
          3,
          "parameters",
          "the parameter"
              + (parameters.size() > 1 ? "s" : "")
              + " ["
              + List.arrayToList(parameters.keysAsString(), ", ")
              + "] "
              + (parameters.size() > 1 ? "are" : "is")
              + " not allowed, only the following parameters are supported [Type, EdgeAction, Interpolation]");
    }

    return filter(src, dst);
  }
예제 #2
0
  public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
    // BufferedImage dst=ImageUtil.createBufferedImage(src,src.getWidth()+400,src.getHeight()+400);
    Object o;
    if ((o = parameters.removeEL(KeyImpl.init("Angle"))) != null)
      setAngle(ImageFilterUtil.toFloatValue(o, "Angle"));
    if ((o = parameters.removeEL(KeyImpl.init("EdgeAction"))) != null)
      setEdgeAction(ImageFilterUtil.toString(o, "EdgeAction"));
    if ((o = parameters.removeEL(KeyImpl.init("Interpolation"))) != null)
      setInterpolation(ImageFilterUtil.toString(o, "Interpolation"));

    // check for arguments not supported
    if (parameters.size() > 0) {
      throw new FunctionException(
          ThreadLocalPageContext.get(),
          "ImageFilter",
          3,
          "parameters",
          "the parameter"
              + (parameters.size() > 1 ? "s" : "")
              + " ["
              + CollectionUtil.getKeyList(parameters, ", ")
              + "] "
              + (parameters.size() > 1 ? "are" : "is")
              + " not allowed, only the following parameters are supported [Angle, EdgeAction, Interpolation]");
    }

    // Rectangle rect = new Rectangle(0, 0, src.getWidth(), src.getHeight());
    // transformSpace(rect);
    BufferedImage dst = null; // ImageUtil.createBufferedImage(src,rect.width,rect.height);

    return filter(src, dst);
  }
예제 #3
0
  @Override
  public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
    // BufferedImage dst=ImageUtil.createBufferedImage(src,src.getWidth()+400,src.getHeight()+400);
    Object o;
    if ((o = parameters.removeEL(KeyImpl.init("XAmplitude"))) != null)
      setXAmplitude(ImageFilterUtil.toFloatValue(o, "XAmplitude"));
    if ((o = parameters.removeEL(KeyImpl.init("XWavelength"))) != null)
      setXWavelength(ImageFilterUtil.toFloatValue(o, "XWavelength"));
    if ((o = parameters.removeEL(KeyImpl.init("YAmplitude"))) != null)
      setYAmplitude(ImageFilterUtil.toFloatValue(o, "YAmplitude"));
    if ((o = parameters.removeEL(KeyImpl.init("YWavelength"))) != null)
      setYWavelength(ImageFilterUtil.toFloatValue(o, "YWavelength"));
    if ((o = parameters.removeEL(KeyImpl.init("WaveType"))) != null)
      setWaveType(ImageFilterUtil.toString(o, "WaveType"));
    if ((o = parameters.removeEL(KeyImpl.init("EdgeAction"))) != null)
      setEdgeAction(ImageFilterUtil.toString(o, "EdgeAction"));
    if ((o = parameters.removeEL(KeyImpl.init("Interpolation"))) != null)
      setInterpolation(ImageFilterUtil.toString(o, "Interpolation"));

    // check for arguments not supported
    if (parameters.size() > 0) {
      throw new FunctionException(
          ThreadLocalPageContext.get(),
          "ImageFilter",
          3,
          "parameters",
          "the parameter"
              + (parameters.size() > 1 ? "s" : "")
              + " ["
              + CollectionUtil.getKeyList(parameters, ", ")
              + "] "
              + (parameters.size() > 1 ? "are" : "is")
              + " not allowed, only the following parameters are supported [XAmplitude, XWavelength, YAmplitude, YWavelength, WaveType, EdgeAction, Interpolation]");
    }

    return filter(src, (BufferedImage) null);
  }