/** * Create a new instance of JiffleOpImage in the rendered layer. * * @param paramBlock specifies the source image and the parameters WRITE ME */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderHints) { String script = (String) paramBlock.getObjectParameter(JiffleDescriptor.SCRIPT_ARG); String destVarName = (String) paramBlock.getObjectParameter(JiffleDescriptor.DEST_NAME_ARG); Rectangle destBounds = (Rectangle) paramBlock.getObjectParameter(JiffleDescriptor.DEST_BOUNDS_ARG); int dataType = paramBlock.getIntParameter(JiffleDescriptor.DEST_TYPE_ARG); // Build an image layout based on the destination bounds, if provided, or the union of the // source bounds ImageLayout layout = (ImageLayout) renderHints.get(JAI.KEY_IMAGE_LAYOUT); if (destBounds != null) { layout = buildLayout(destBounds, getPreferredTileSize(paramBlock), dataType); } else if (layout == null) { destBounds = getSourceBounds(paramBlock); layout = buildLayout(destBounds, getPreferredTileSize(paramBlock), dataType); } Map<String, JiffleOpImage.ImageSpecification> sourceImages = buildSourceImageMap(paramBlock); return new JiffleOpImage(sourceImages, layout, renderHints, script, destVarName); }
private Rectangle getSourceBounds(ParameterBlock pb) { Rectangle boundsUnion = null; if (pb.getNumSources() > 0) { boundsUnion = getSourceBounds(pb, 0); for (int i = 1; i < pb.getNumSources(); i++) { Rectangle imageBounds = getSourceBounds(pb, i); boundsUnion = boundsUnion.union(imageBounds); } } return boundsUnion; }
/** * Registers the MaskedConvolve operation and its * associated image factories across all supported operation modes. * * @param registry The registry with which to register the operations * and their factories. */ public void updateRegistry(OperationRegistry registry) { OperationDescriptor op = new JiffleDescriptor(); registry.registerDescriptor(op); String descName = op.getName(); RenderedImageFactory rif = new JiffleRIF(); registry.registerFactory(RenderedRegistryMode.MODE_NAME, descName, productName, rif); } }
for (int i = 0; i < sources.size(); i++) { if (i == 0) { result.put("src", getImageSpecification(sources, cts, bts, i)); } else { result.put("src" + i, getImageSpecification(sources, cts, bts, i)); result.put(names[i], getImageSpecification(sources, cts, bts, i));
private Rectangle getSourceBounds(ParameterBlock pb) { Rectangle boundsUnion = null; if (pb.getNumSources() > 0) { boundsUnion = getSourceBounds(pb, 0); for (int i = 1; i < pb.getNumSources(); i++) { Rectangle imageBounds = getSourceBounds(pb, i); boundsUnion = boundsUnion.union(imageBounds); } } return boundsUnion; }
/** * Registers the MaskedConvolve operation and its * associated image factories across all supported operation modes. * * @param registry The registry with which to register the operations * and their factories. */ public void updateRegistry(OperationRegistry registry) { OperationDescriptor op = new JiffleDescriptor(); registry.registerDescriptor(op); String descName = op.getName(); RenderedImageFactory rif = new JiffleRIF(); registry.registerFactory(RenderedRegistryMode.MODE_NAME, descName, productName, rif); } }
for (int i = 0; i < sources.size(); i++) { if (i == 0) { result.put("src", getImageSpecification(sources, cts, bts, i)); } else { result.put("src" + i, getImageSpecification(sources, cts, bts, i)); result.put(names[i], getImageSpecification(sources, cts, bts, i));
/** * Create a new instance of JiffleOpImage in the rendered layer. * * @param paramBlock specifies the source image and the parameters WRITE ME */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderHints) { String script = (String) paramBlock.getObjectParameter(JiffleDescriptor.SCRIPT_ARG); String destVarName = (String) paramBlock.getObjectParameter(JiffleDescriptor.DEST_NAME_ARG); Rectangle destBounds = (Rectangle) paramBlock.getObjectParameter(JiffleDescriptor.DEST_BOUNDS_ARG); int dataType = paramBlock.getIntParameter(JiffleDescriptor.DEST_TYPE_ARG); // Build an image layout based on the destination bounds, if provided, or the union of the // source bounds ImageLayout layout = (ImageLayout) renderHints.get(JAI.KEY_IMAGE_LAYOUT); if (destBounds != null) { layout = buildLayout(destBounds, getPreferredTileSize(paramBlock), dataType); } else if (layout == null) { destBounds = getSourceBounds(paramBlock); layout = buildLayout(destBounds, getPreferredTileSize(paramBlock), dataType); } Map<String, JiffleOpImage.ImageSpecification> sourceImages = buildSourceImageMap(paramBlock); return new JiffleOpImage(sourceImages, layout, renderHints, script, destVarName); }