Java Code Examples for java.awt.image.renderable.ParameterBlock#getRenderedSource()

The following examples show how to use java.awt.image.renderable.ParameterBlock#getRenderedSource() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: geowave   File: MosaicPropertyGenerator.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Object getProperty(final String name, final Object opNode) {
  validate(name, opNode);

  if ((opNode instanceof RenderedOp) && name.equalsIgnoreCase("sourceThreshold")) {
    final RenderedOp op = (RenderedOp) opNode;

    final ParameterBlock pb = op.getParameterBlock();

    // Retrieve the rendered source image and its ROI.
    final RenderedImage src = pb.getRenderedSource(0);
    final Object property = src.getProperty("sourceThreshold");
    if (property != null) {
      return property;
    } // Getting the Threshold to use
    final double threshold =
        CoverageUtilities.getMosaicThreshold(src.getSampleModel().getDataType());
    // Setting the Threshold object for the mosaic
    return new double[][] {{threshold}};
  }
  return java.awt.Image.UndefinedProperty;
}
 
Example 2
Source Project: pdfxtk   File: BinarizeDescriptor.java    License: Apache License 2.0 6 votes vote down vote up
/** Creates an BinarizeOpImage with a given ParameterBlock */

  public RenderedImage create(ParameterBlock paramBlock, 
			      RenderingHints renderingHints)
  {
    RenderedImage img = paramBlock.getRenderedSource(0);

    ImageLayout il = new ImageLayout(img);
    ColorModel cm = new IndexColorModel(1, 2, bwColors, bwColors, bwColors);
    SampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
						     img.getWidth(),
						     img.getHeight(),
						     1);

    il.setColorModel(cm);
    il.setSampleModel(sm);

    return new BinarizeOpImage(paramBlock.getRenderedSource(0),
			       renderingHints,
			       il,
			       (Integer)paramBlock.getObjectParameter(0));
  }
 
Example 3
Source Project: geowave   File: WarpRIF.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance of warp operator according to the warp object and interpolation method.
 *
 * @param paramBlock The warp and interpolation objects.
 */
@Override
public RenderedImage create(final ParameterBlock paramBlock, final RenderingHints renderHints) {
  final Interpolation interp = (Interpolation) paramBlock.getObjectParameter(1);
  if ((interp instanceof InterpolationNearest)
      || (interp instanceof javax.media.jai.InterpolationNearest)) {
    // Get ImageLayout from renderHints if any.
    final ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);

    RenderedImage source = paramBlock.getRenderedSource(0);
    final Warp warp = (Warp) paramBlock.getObjectParameter(0);
    final double[] backgroundValues = (double[]) paramBlock.getObjectParameter(2);

    ROI roi = null;
    final Object roi_ = paramBlock.getObjectParameter(3);
    if (roi_ instanceof ROI) {
      roi = (ROI) roi_;
      final PlanarImage temp = PlanarImage.wrapRenderedImage(source);
      temp.setProperty("ROI", roi);
      source = temp;
    }
    Range noData = (Range) paramBlock.getObjectParameter(4);
    noData = RangeFactory.convert(noData, source.getSampleModel().getDataType());
    return new WarpNearestOpImage(
        source,
        renderHints,
        layout,
        warp,
        interp,
        roi,
        noData,
        backgroundValues);
  }
  return super.create(paramBlock, renderHints);
}
 
Example 4
Source Project: pdfxtk   File: SkeletonDescriptor.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates an RLSAOpImage with a given ParameterBlock */

  public RenderedImage create(ParameterBlock paramBlock, 
			      RenderingHints renderingHints)
  {
    return new SkeletonOpImage(paramBlock.getRenderedSource(0),
			       renderingHints,
			       new ImageLayout(paramBlock.getRenderedSource(0)),
			       (Boolean) paramBlock.getObjectParameter(0));
  }
 
Example 5
Source Project: pdfxtk   File: BlackOrDescriptor.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a BlackOrOpImage with a given ParameterBlock */

  public RenderedImage create(ParameterBlock paramBlock, 
			      RenderingHints renderingHints)
  {
    return new BlackOrOpImage(paramBlock.getRenderedSource(0),
			      paramBlock.getRenderedSource(1),
			      new ImageLayout(paramBlock.getRenderedSource(0)),
			      renderingHints,
			      true);
  }
 
Example 6
Source Project: pdfxtk   File: PowerDescriptor.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates an PowerOpImage with a given ParameterBlock */

  public RenderedImage create(ParameterBlock paramBlock, 
			      RenderingHints renderingHints)
  {
    return new PowerOpImage(paramBlock.getRenderedSource(0),
			    renderingHints,
			    new ImageLayout(paramBlock.getRenderedSource(0)),
			    (Double) paramBlock.getObjectParameter(0));
  }
 
Example 7
Source Project: pdfxtk   File: CCDescriptor.java    License: Apache License 2.0 5 votes vote down vote up
/** Invokes the operator with a given ParameterBlock */

  public RenderedImage create(ParameterBlock paramBlock, 
			      RenderingHints renderHints)
  {
    return new CCOpImage(paramBlock.getRenderedSource(0),
			 (Rectangle) paramBlock.getObjectParameter(0));
  }
 
Example 8
Source Project: pdfxtk   File: RLSADescriptor.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates an RLSAOpImage with a given ParameterBlock */

  public RenderedImage create(ParameterBlock paramBlock, 
			      RenderingHints renderHints)
  {
    return new RLSAOpImage(paramBlock.getRenderedSource(0),
			   null,
			   new ImageLayout(paramBlock.getRenderedSource(0)),
			   (Integer) paramBlock.getObjectParameter(0),
			   (Integer) paramBlock.getObjectParameter(1));
  }
 
Example 9
public RenderedImage create(ParameterBlock paramBlock, 
	      RenderingHints renderHints)
{
  if (!validateParameters(paramBlock)) { 
    return null;
  } 
  
  return new ProjectionProfileOpImage
    (paramBlock.getRenderedSource(0),
     (Rectangle) paramBlock.getObjectParameter(0));
}