Example #1
0
  /**
   * Creates a new instance of <code>BandSelectOpImage</code> in the rendered layer.
   *
   * @param args The source image and the constants.
   * @param hints Optionally contains destination image layout.
   */
  public RenderedImage create(ParameterBlock args, RenderingHints renderHints) {
    // Get ImageLayout from renderHints if any.
    ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);

    return new BandSelectOpImage(
        args.getRenderedSource(0), renderHints, layout, (int[]) args.getObjectParameter(0));
  }
  /**
   * Creates a new instance of SubsampleAverageOpImage in the rendered layer. This method satisfies
   * the implementation of RIF.
   *
   * @param paramBlock The source image, the X and Y scale factor, and the interpolation method for
   *     resampling.
   */
  public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderHints) {

    // Get ImageLayout from renderHints if any.
    ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);

    RenderedImage source = paramBlock.getRenderedSource(0);
    double scaleX = paramBlock.getDoubleParameter(0);
    double scaleY = paramBlock.getDoubleParameter(1);

    // Check and see if we are scaling by 1.0 in both x and y and no
    // translations. If so return the source directly.
    if (scaleX == 1.0 && scaleY == 1.0) {
      return source;
    }

    return new SubsampleAverageOpImage(source, layout, renderHints, scaleX, scaleY);
  }