/** Set the parameter value as an integer. */ public void setValue(final int value) throws InvalidParameterValueException { final String name = getName(); final Class type = getType(); try { if (type.equals(Short.class)) { parameters.setParameter(name, (short) value); return; } if (type.equals(Byte.class)) { parameters.setParameter(name, (byte) value); return; } parameters.setParameter(name, value); } catch (ClassCastException exception) { throw invalidType(exception); } }
/** Set the parameter value as a floating point. */ public void setValue(final double value) throws InvalidParameterValueException { final String name = getName(); final Class type = getType(); try { if (type.equals(Float.class)) { parameters.setParameter(name, (float) value); return; } if (type.equals(Long.class)) { parameters.setParameter(name, (long) value); return; } if (type.equals(Integer.class)) { parameters.setParameter(name, (int) value); return; } if (type.equals(Short.class)) { parameters.setParameter(name, (short) value); return; } if (type.equals(Byte.class)) { parameters.setParameter(name, (byte) value); return; } parameters.setParameter(name, value); } catch (ClassCastException exception) { throw invalidType(exception); } }
/** * Loads an image using the provided file name and the {@linkplain #getRenderingHints current * hints}, which are used to control caching and layout. * * @param source Filename of the source image to read. * @param imageChoice Image index in multipage images. * @param readMatadata If {@code true}, metadata will be read. */ public final void load(final String source, final int imageChoice, final boolean readMetadata) { final ParameterBlockJAI pbj = new ParameterBlockJAI("ImageRead"); pbj.setParameter("Input", source) .setParameter("ImageChoice", Integer.valueOf(imageChoice)) .setParameter("ReadMetadata", Boolean.valueOf(readMetadata)) .setParameter("VerifyInput", Boolean.TRUE); image = JAI.create("ImageRead", pbj, getRenderingHints()); }
/** Set the parameter value as a boolean. */ public void setValue(final boolean value) throws InvalidParameterValueException { final String name = getName(); try { parameters.setParameter(name, value); } catch (ClassCastException exception) { throw invalidType(exception); } }
/** * Set the parameter value as an object. The object type is typically a {@link Double}, {@link * Integer}, {@link Boolean}, {@link String}, {@link URI}, {@code double[]} or {@code int[]}. */ public void setValue(final Object value) throws InvalidParameterValueException { final String name = getName(); try { parameters.setParameter(name, value); } catch (ClassCastException exception) { throw invalidType(exception); } }
assertSame(pl, pl.setParameter("xPeriod", 2)); assertSame(pl, pl.setParameter("yPeriod", 2)); assertEquals(2, pl.getIntParameter("xPeriod")); assertEquals(2, pl.getIntParameter("yPeriod"));
/** * Loads an image using the provided file name and the * {@linkplain #getRenderingHints current hints}, which are used to control caching and layout. * * @param source Filename of the source image to read. * @param imageChoice Image index in multipage images. * @param readMatadata If {@code true}, metadata will be read. */ public final void load(final String source, final int imageChoice, final boolean readMetadata) { final ParameterBlockJAI pbj = new ParameterBlockJAI("ImageRead"); pbj.setParameter("Input", source) .setParameter("ImageChoice", Integer.valueOf(imageChoice)) .setParameter("ReadMetadata", Boolean.valueOf(readMetadata)) .setParameter("VerifyInput", Boolean.TRUE); image = JAI.create("ImageRead", pbj, getRenderingHints()); }
/** * Loads an image using the provided file name and the * {@linkplain #getRenderingHints current hints}, which are used to control caching and layout. * * @param source * Filename of the source image to read. * @param imageChoice * Image index in multipage images. * @param readMatadata * If {@code true}, metadata will be read. */ public final void load(final String source, final int imageChoice, final boolean readMetadata) { final ParameterBlockJAI pbj = new ParameterBlockJAI("ImageRead"); pbj.setParameter("Input", source) .setParameter("ImageChoice", new Integer(imageChoice)) .setParameter("ReadMetadata", new Boolean(readMetadata)) .setParameter("VerifyInput", Boolean.TRUE); image = JAI.create("ImageRead", pbj, getRenderingHints()); }
final ParameterValue before = values.parameter("constants"); if ((i % 5) == 0) { values.parameters.setParameter("constants", new double[] {i}); } else { values.parameter("constants").setValue(new double[] {i});
block.setParameter("Mask1", divide(mask1, factor*scaleMask1)); block.setParameter("Mask2", divide(mask2, factor*scaleMask2));
block.setParameter("Mask1", divide(mask1, factor*scaleMask1)); block.setParameter("Mask2", divide(mask2, factor*scaleMask2));