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) { 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); }
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); }
/** * Validates supplied parameters. * * @param modeName the rendering mode * @param pb the parameter block * @param msg a {@code StringBuffer} to receive error messages * * @return {@code true} if parameters are valid; {@code false} otherwise */ @Override protected boolean validateParameters(String modeName, ParameterBlock pb, StringBuffer msg) { boolean ok = super.validateParameters(modeName, pb, msg); if (ok) { int filterMethod = pb.getIntParameter(FILTER_METHOD_ARG); if ( !(filterMethod == FILTER_MERGE_LARGEST || filterMethod == FILTER_MERGE_RANDOM || filterMethod == FILTER_DELETE) ) { ok = false; msg.append("Invalid filter method: ").append(filterMethod); } } return ok; }
@Override public boolean validateArguments(String modeName, ParameterBlock pb, StringBuffer msg) { if (!super.validateArguments(modeName, pb, msg)) { return false; } int band = pb.getIntParameter(BAND_ARG_INDEX); if (band < 0 || band >= pb.getNumSources()) { msg.append("band arg out of bounds for source image: " + band); return false; } return true; }
/** * 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); } }
/** * Creates a {@link RenderedImage} representing the results of an imaging * operation for a given {@link ParameterBlock} and {@link RenderingHints}. * * @param param The parameter to be given to the image operation. * @param hints An optional set of hints, or {@code null}. */ @Override 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); } }
/** * 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); }
/** * Creates a new instance of <code>BorderOpImage</code> in the rendered layer. * * @param args The source image and the border information * @param hints Optionally contains destination image layout. */ public RenderedImage create(ParameterBlock pb, RenderingHints renderHints) { // Get ImageLayout from renderHints if any. ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints); // Selection of the source RenderedImage source = pb.getRenderedSource(0); // Selection of the parameters int leftPad = pb.getIntParameter(0); int rightPad = pb.getIntParameter(1); int topPad = pb.getIntParameter(2); int bottomPad = pb.getIntParameter(3); BorderExtender type = (BorderExtender) pb.getObjectParameter(4); Range noData = (Range) pb.getObjectParameter(5); noData = RangeFactory.convert(noData, source.getSampleModel().getDataType()); double destinationNoData = pb.getDoubleParameter(6); // Creation of the BorderOpImage instance return new BorderOpImage(source, renderHints, layout, leftPad, rightPad, topPad, bottomPad, type, noData, destinationNoData); } }
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); }
public RenderedImage create(ParameterBlock pb, RenderingHints hints) { // Getting ImageLayout ImageLayout l = RIFUtil.getImageLayoutHint(hints); // Getting Source RenderedImage source = pb.getRenderedSource(0); // Extracting Parameters final PiecewiseTransform1D lic = (PiecewiseTransform1D) pb.getObjectParameter(0); final Integer bandIndex = pb.getIntParameter(1); final ROI roi = (ROI) pb.getObjectParameter(2); final Range nodata = (Range) pb.getObjectParameter(3); return new GenericPiecewiseOpImage<PiecewiseTransform1DElement>(source, lic, l, bandIndex, roi, nodata, hints, true); }
public RenderedImage create(ParameterBlock pb, RenderingHints hints) { // Getting ImageLayout ImageLayout l = RIFUtil.getImageLayoutHint(hints); // Getting Source RenderedImage source = pb.getRenderedSource(0); // Extracting Parameters final PiecewiseTransform1D lic = (PiecewiseTransform1D) pb.getObjectParameter(0); final Integer bandIndex = pb.getIntParameter(1); final ROI roi = (ROI) pb.getObjectParameter(2); final Range nodata = (Range) pb.getObjectParameter(3); return new GenericPiecewiseOpImage<PiecewiseTransform1DElement>(source, lic, l, bandIndex, roi, nodata, hints, true); }
/** * 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) { // Getting Source final RenderedImage image = (RenderedImage) param.getSource(0); // Getting imageLayout ImageLayout layout = RIFUtil.getImageLayoutHint(hints); // Getting parameters final ColorMapTransform<ColorMapTransformElement> lic = (ColorMapTransform<ColorMapTransformElement>) param .getObjectParameter(0); final int bandIndex = param.getIntParameter(1); ROI roi = (ROI) param.getObjectParameter(2); Range nodata = (Range) param.getObjectParameter(3); // Creating the RasterClassifierOpImage return new RasterClassifierOpImage(image, lic, layout, bandIndex, roi, nodata, hints); }
/** * Returns {@code true} if the parameters are valids. This implementation check that the number of bands in the source image is equals to the * number of supplied sample dimensions, and that all sample dimensions has pieces. * * @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 RenderedImage source = (RenderedImage) param.getSource(0); final Domain1D lic = (Domain1D) param.getObjectParameter(0); if (lic == null) return false; final int numBands = source.getSampleModel().getNumBands(); final int bandIndex = param.getIntParameter(1); if (bandIndex == -1) return true; if (bandIndex < 0 || bandIndex >= numBands) { return false; } return true; }
/** * Returns {@code true} if the parameters are valids. This implementation check that the number of bands in the source image is equals to the * number of supplied sample dimensions, and that all sample dimensions has pieces. * * @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 RenderedImage source = (RenderedImage) param.getSource(0); final Domain1D lic = (Domain1D) param.getObjectParameter(0); if (lic == null) return false; final int numBands = source.getSampleModel().getNumBands(); final int bandIndex = param.getIntParameter(1); if (bandIndex == -1) return true; if (bandIndex < 0 || bandIndex >= numBands) { return false; } return true; }
public RenderedImage create(ParameterBlock paramBlock, RenderingHints hints) { // Get ImageLayout from renderHints if any. ImageLayout layout = RIFUtil.getImageLayoutHint(hints); // Get the source image RenderedImage source = paramBlock.getRenderedSource(0); // Get the parameters LookupTableJAI lookupTable = (LookupTableJAI) paramBlock.getObjectParameter(0); KernelJAI kernel = (KernelJAI) paramBlock.getObjectParameter(1); ROI roi = (ROI) paramBlock.getObjectParameter(2); Range nodata = (Range) paramBlock.getObjectParameter(3); int destNoData =paramBlock.getIntParameter(4); return new ErrorDiffusionOpImage(source, hints, layout, lookupTable, kernel, roi, nodata, destNoData); }
/** * 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) { // Getting Source final RenderedImage image = (RenderedImage) param.getSource(0); // Getting imageLayout ImageLayout layout = RIFUtil.getImageLayoutHint(hints); // Getting parameters final ColorMapTransform<ColorMapTransformElement> lic = (ColorMapTransform<ColorMapTransformElement>) param .getObjectParameter(0); final int bandIndex = param.getIntParameter(1); ROI roi = (ROI) param.getObjectParameter(2); Range nodata = (Range) param.getObjectParameter(3); // Creating the RasterClassifierOpImage return new RasterClassifierOpImage(image, lic, layout, bandIndex, roi, nodata, hints); }
public RenderedImage create(ParameterBlock paramBlock, RenderingHints hints) { // Get ImageLayout from renderHints if any. ImageLayout layout = RIFUtil.getImageLayoutHint(hints); // Get the source image RenderedImage source = paramBlock.getRenderedSource(0); // Get the parameters LookupTableJAI lookupTable = (LookupTableJAI) paramBlock.getObjectParameter(0); KernelJAI kernel = (KernelJAI) paramBlock.getObjectParameter(1); ROI roi = (ROI) paramBlock.getObjectParameter(2); Range nodata = (Range) paramBlock.getObjectParameter(3); int destNoData =paramBlock.getIntParameter(4); return new ErrorDiffusionOpImage(source, hints, layout, lookupTable, kernel, roi, nodata, destNoData); }