/** * Returns {@code true} if this operation supports the specified mode, and is capable of * handling the given input source(s) for the specified mode. * * @param modeName The mode name (usually "Rendered"). * @param param The parameter block for the operation to performs. * @param message A buffer for formatting an error message if any. */ protected boolean validateSources( final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i = param.getNumSources(); --i >= 0; ) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { return false; } } return true; } return false; }
private Dimension getPreferredTileSize(ParameterBlock pb) { if (pb.getSources() == null || pb.getSources().size() == 0) { return JAI.getDefaultTileSize(); } else { // align to the first input, should reduce the computation cost as the source // tiles are pulled only once RenderedImage ref = (RenderedImage) pb.getSource(0); return new Dimension(ref.getWidth(), ref.getHeight()); } }
/** * Returns {@code true} if this operation supports the specified mode, and is capable of * handling the given input source(s) for the specified mode. * * @param modeName The mode name (usually "Rendered"). * @param param The parameter block for the operation to performs. * @param message A buffer for formatting an error message if any. */ protected boolean validateSources( final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i = param.getNumSources(); --i >= 0; ) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { return false; } } return true; } return false; }
private Dimension getPreferredTileSize(ParameterBlock pb) { if (pb.getSources() == null || pb.getSources().size() == 0) { return JAI.getDefaultTileSize(); } else { // align to the first input, should reduce the computation cost as the source // tiles are pulled only once RenderedImage ref = (RenderedImage) pb.getSource(0); return new Dimension(ref.getWidth(), ref.getHeight()); } }
/** * Returns {@code true} if the parameters are valids. This implementation check that the number * of bands in the source src1 is equals to the number of bands of source src2. * * @param modeName The mode name (usually "Rendered"). * @param param The parameter block for the operation to performs. * @param message A buffer for formatting an error message if any. */ protected boolean validateParameters( final String modeName, final ParameterBlock param, final StringBuffer message) { if (!super.validateParameters(modeName, param, message)) { return false; } final int numColors = ((Integer) param.getObjectParameter(0)).intValue(); final int alphaThreashold = ((Integer) param.getObjectParameter(1)).intValue(); final int ssx = ((Integer) param.getObjectParameter(2)).intValue(); final int ssy = ((Integer) param.getObjectParameter(3)).intValue(); final RenderedImage source = (RenderedImage) param.getSource(0); if (ssx <= 1 && ssx >= source.getWidth()) return false; if (ssy <= 1 && ssy >= source.getHeight()) return false; if (alphaThreashold < 0 || alphaThreashold > 255) return false; if (numColors <= 0 || (numColors > 256)) return false; return true; } }
public RenderedImage create(ParameterBlock pb, RenderingHints hints) { final RenderedImage image = (RenderedImage) pb.getSource(0); final IndexColorModel icm = (IndexColorModel) pb.getObjectParameter(0); final int quantizationColors = pb.getIntParameter(1); final int alpaThreshold = pb.getIntParameter(2); return new ColorInversion(image, icm, quantizationColors, alpaThreshold); } }
public RenderedImage create(ParameterBlock pb, RenderingHints hints) { final RenderedImage image = (RenderedImage) pb.getSource(0); final int numColors = pb.getIntParameter(0); final int alpaThreshold = pb.getIntParameter(1); final int subsx = pb.getIntParameter(2); final int subsy = pb.getIntParameter(3); return new ColorReduction(image, hints, numColors, alpaThreshold, subsx, subsy); } }
private Rectangle getSourceBounds(ParameterBlock pb, int imageIdx) { RenderedImage source = (RenderedImage) pb.getSource(imageIdx); return new Rectangle( source.getMinX(), source.getMinY(), source.getWidth(), source.getHeight()); } }
private Rectangle getSourceBounds(ParameterBlock pb, int imageIdx) { RenderedImage source = (RenderedImage) pb.getSource(imageIdx); return new Rectangle( source.getMinX(), source.getMinY(), source.getWidth(), source.getHeight()); } }
/** * If the PB has more than one source, replace it with a new PB which has only one source equal to the first source of the input. We want to * support an arbitrary number of sources but only care that there is at least one of the appropriate class. */ private static ParameterBlock foolSourceValidation(ParameterBlock args) { if (args.getNumSources() > 1) { Vector singleSource = new Vector(); singleSource.add(args.getSource(0)); args = new ParameterBlock(singleSource, args.getParameters()); } return args; }
/** * Creates a {@link RenderedImage} representing the results of an * imaging operation for a given {@link ParameterBlock} and * {@link RenderingHints}. */ @SuppressWarnings("unchecked") public RenderedImage create(final ParameterBlock param, final RenderingHints hints) { final RenderedImage image = (RenderedImage) param.getSource(0); final PiecewiseTransform1D lic = (PiecewiseTransform1D) param.getObjectParameter(0); return new GenericPiecewise(image, lic, hints); }
/** * If the PB has more than one source, replace it with a new PB which has only one source equal to the first source of the input. We want to * support an arbitrary number of sources but only care that there is at least one of the appropriate class. */ private static ParameterBlock foolSourceValidation(ParameterBlock args) { if (args.getNumSources() > 1) { Vector singleSource = new Vector(); singleSource.add(args.getSource(0)); args = new ParameterBlock(singleSource, args.getParameters()); } return args; }
/** * Creates a {@link RenderedImage} representing the results of an * imaging operation for a given {@link ParameterBlock} and * {@link RenderingHints}. */ public RenderedImage create(final ParameterBlock param, final RenderingHints hints) { final RenderedImage image = (RenderedImage) param.getSource(0); final ColorMapTransform<ColorMapTransformElement> lic = (ColorMapTransform<ColorMapTransformElement>) param.getObjectParameter(0); final int bandIndex = param.getIntParameter(1); return new RasterClassifier(image, lic, bandIndex, hints); }
public RenderedImage create(ParameterBlock pb, RenderingHints hints) { final RenderedImage image = (RenderedImage) pb.getSource(0); final IndexColorModel icm = (IndexColorModel) pb.getObjectParameter(0); final int quantizationColors = pb.getIntParameter(1); final int alpaThreshold = pb.getIntParameter(2); return new ColorInversion(image,icm,quantizationColors, alpaThreshold); }
/** * Creates a {@link RenderedImage} representing the results of an imaging * operation for a given {@link ParameterBlock} and {@link RenderingHints}. */ public RenderedImage create(final ParameterBlock param, final RenderingHints hints) { final RenderedImage source = (RenderedImage) param.getSource(0); final Number oldNoData= (Number) param.getObjectParameter(0); final Short newNoData= (Short) param.getObjectParameter(1); final Double EPS= (Double) param.getObjectParameter(2); return new NoDataReplacerOpImage(source, oldNoData,newNoData,EPS, hints); }
/** * Creates a {@link RenderedImage} representing the results of an imaging * operation for a given {@link ParameterBlock} and {@link RenderingHints}. */ public RenderedImage create(final ParameterBlock param, final RenderingHints hints) { final RenderedImage image = (RenderedImage)param.getSource(0); final ImageLayout layout = (ImageLayout)hints.get(JAI.KEY_IMAGE_LAYOUT); final int padding = param.getIntParameter(0); final int validityThreshold = param.getIntParameter(1); return new NodataFilter(image, layout, hints, padding, validityThreshold); } }
public RenderedImage create(ParameterBlock pb, RenderingHints hints) { final RenderedImage image = (RenderedImage) pb.getSource(0); final int numColors = pb.getIntParameter(0); final int alpaThreshold = pb.getIntParameter(1); final int subsx = pb.getIntParameter(2); final int subsy = pb.getIntParameter(3); return new ColorReduction(image, hints, numColors, alpaThreshold, subsx, subsy); }
public RenderedImage create(ParameterBlock pb, RenderingHints hints) { // Getting Source final RenderedImage image = (RenderedImage) pb.getSource(0); // Getting parameters final ColorIndexer indeder = (ColorIndexer) pb.getObjectParameter(0); final ROI roi = (ROI) pb.getObjectParameter(1); final Range nodata = (Range) pb.getObjectParameter(2); final int destNoData = pb.getIntParameter(3); // Creating a new OpImage return new ColorIndexerOpImage(image, indeder, roi, nodata, destNoData, hints); }
public RenderedImage create(ParameterBlock pb, RenderingHints hints) { // Getting Source final RenderedImage image = (RenderedImage) pb.getSource(0); // Getting parameters final ColorIndexer indeder = (ColorIndexer) pb.getObjectParameter(0); final ROI roi = (ROI) pb.getObjectParameter(1); final Range nodata = (Range) pb.getObjectParameter(2); final int destNoData = pb.getIntParameter(3); // Creating a new OpImage return new ColorIndexerOpImage(image, indeder, roi, nodata, destNoData, hints); }
/** * Creates a {@link RenderedImage} for the results of an imaging * operation for a given {@link ParameterBlock} and {@link RenderingHints}. */ public RenderedImage create(final ParameterBlock param, final RenderingHints hints) { final RenderedImage image = (RenderedImage)param.getSource(0); final ImageLayout layout = (ImageLayout)hints.get(JAI.KEY_IMAGE_LAYOUT); final double low = param.getDoubleParameter(0); final double high = param.getDoubleParameter(1); final double padValue = param.getDoubleParameter(2); return new Hysteresis(image, layout, hints, low, high, padValue); } }