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

The following examples show how to use java.awt.image.renderable.ParameterBlock#getRenderedSource() . 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 check out the related API usage on the sidebar.
Example 1
Source File: MosaicPropertyGenerator.java    From geowave with 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 File: BinarizeDescriptor.java    From pdfxtk with 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 File: WarpRIF.java    From geowave with 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 File: SkeletonDescriptor.java    From pdfxtk with 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 File: BlackOrDescriptor.java    From pdfxtk with 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 File: PowerDescriptor.java    From pdfxtk with 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 File: CCDescriptor.java    From pdfxtk with 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 File: RLSADescriptor.java    From pdfxtk with 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
Source File: ProjectionProfileDescriptor.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
public RenderedImage create(ParameterBlock paramBlock, 
	      RenderingHints renderHints)
{
  if (!validateParameters(paramBlock)) { 
    return null;
  } 
  
  return new ProjectionProfileOpImage
    (paramBlock.getRenderedSource(0),
     (Rectangle) paramBlock.getObjectParameter(0));
}