本文整理汇总了Java中java.awt.image.renderable.ParameterBlock.getObjectParameter方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterBlock.getObjectParameter方法的具体用法?Java ParameterBlock.getObjectParameter怎么用?Java ParameterBlock.getObjectParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.renderable.ParameterBlock
的用法示例。
在下文中一共展示了ParameterBlock.getObjectParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateParameters
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Validates the input parameter.
*
* <p> In addition to the standard checks performed by the
* superclass method, this method checks that the length of the
* "constants" array is at least 1.
*/
protected boolean validateParameters(ParameterBlock args,
StringBuffer message) {
if (!super.validateParameters(args, message)) {
return false;
}
int length = ((double[])args.getObjectParameter(0)).length;
if (length < 1) {
message.append(getName() + " " +
JaiI18N.getString("MultiplyConstDescriptor2"));
return false;
}
return true;
}
示例2: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>AWTImageOpImage</code>
* in the rendered layer.
* This method satisfies the implementation of RIF.
*
* @param paramBlock The AWT image.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
// Extract the source AWT Image and cast it.
Image awtImage = (Image)paramBlock.getObjectParameter(0);
// If it's already a RenderedImage (as for a BufferedImage) just cast.
if(awtImage instanceof RenderedImage) {
return (RenderedImage)awtImage;
}
// Create a RenderedImage from the data.
return new AWTImageOpImage(renderHints, layout, awtImage);
}
示例3: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>DivideByConstOpImage</code> in the
* rendered layer.
*
* @param args The source image and the constants.
* @param hints Optionally contains destination image layout.
*/
public RenderedImage create(ParameterBlock args,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
/* Invert the constants. */
double[] constants = (double[])args.getObjectParameter(0);
int length = constants.length;
double[] invConstants = new double[length];
for (int i = 0; i < length; i++) {
invConstants[i] = 1.0 / constants[i];
}
return new MultiplyConstOpImage(args.getRenderedSource(0),
renderHints,
layout,
invConstants);
}
示例4: validateParameters
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Validates the input parameters.
*
* <p> In addition to the standard checks performed by the
* superclass method, this method checks that the length of the
* "constants" array is at least 1.
*/
protected boolean validateParameters(ParameterBlock args,
StringBuffer message) {
if (!super.validateParameters(args, message)) {
return false;
}
int length = ((double[])args.getObjectParameter(0)).length;
if (length < 1) {
message.append(getName() + " " +
JaiI18N.getString("DivideByConstDescriptor2"));
return false;
}
return true;
}
示例5: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>QuicklookOlciOpImage</code> in the
* rendered layer. This operator could be called by chunks of images.
* A set of additional information are required to compute the pixels
* adjustment such as sun azimuth/elevation and detectors... The methods to
* extract these informations are also provided here before.
*
* @param paramBlock The three R/G/B sources images to be "Merged" together
* to produce the Quicklook.
* @param renderHints Optionally contains destination image layout.
*/
public RenderedImage create(ParameterBlock paramBlock, RenderingHints hints)
{
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(hints);
// Get the number of the sources
int numSources = paramBlock.getNumSources();
// Creation of a source ArrayList (better than a Vector)
List<RenderedImage> sources = new ArrayList<RenderedImage>(numSources);
// Addition of the sources to the List
for (int i = 0; i < numSources; i++)
{
sources.add((RenderedImage)paramBlock.getSource(i));
}
// Extracts parameters
short[][] detectors = (short[][])paramBlock.getObjectParameter(0);
double[][] sza = (double[][])paramBlock.getObjectParameter(1);
float[][] solar_flux = (float[][])paramBlock.getObjectParameter(2);
PixelCorrection[]pc=(PixelCorrection[])paramBlock.getObjectParameter(3);
int[] bands = (int[])paramBlock.getObjectParameter(4);
int[] coefficients = (int[])paramBlock.getObjectParameter(5);
return new QuicklookOlciOpImage(sources, hints, detectors, sza,
solar_flux, pc, bands, coefficients, layout);
}
示例6: validateParameters
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/** Validates input parameters. */
protected boolean validateParameters(ParameterBlock args,
StringBuffer msg) {
int numParams = args.getNumParameters();
if (numParams < 3) {
msg.append(getName() + " " +
JaiI18N.getString("ThresholdDescriptor4"));
return false;
}
for (int i = 0; i < 3; i++) {
Object p = args.getObjectParameter(i);
if (p == null) {
msg.append(getName() + " " +
JaiI18N.getString("ThresholdDescriptor5"));
return false;
}
if (!(p instanceof double[])) {
msg.append(getName() + " " +
JaiI18N.getString("ThresholdDescriptor6"));
return false;
}
if (((double[])p).length < 1) {
msg.append(getName() + " " +
JaiI18N.getString("ThresholdDescriptor7"));
return false;
}
}
return true;
}
示例7: validateArguments
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Validates the input source and parameter.
*
* <p> In addition to the standard checks performed by the
* superclass method, this method checks that the source image has
* an integral data type and that "constants" has length at least 1.
*/
public boolean validateArguments(String modeName,
ParameterBlock args,
StringBuffer message) {
if (!super.validateArguments(modeName, args, message)) {
return false;
}
if (!modeName.equalsIgnoreCase("rendered"))
return true;
RenderedImage src = args.getRenderedSource(0);
int dtype = src.getSampleModel().getDataType();
if (dtype != DataBuffer.TYPE_BYTE &&
dtype != DataBuffer.TYPE_USHORT &&
dtype != DataBuffer.TYPE_SHORT &&
dtype != DataBuffer.TYPE_INT) {
message.append(getName() + " " +
JaiI18N.getString("OrConstDescriptor2"));
return false;
}
int length = ((int[])args.getObjectParameter(0)).length;
if (length < 1) {
message.append(getName() + " " +
JaiI18N.getString("OrConstDescriptor3"));
return false;
}
return true;
}
示例8: validateParameters
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Returns <code>true</code> if this operation is capable of handling
* the input parameters.
*
* <p> In addition to the default validations done in the super class,
* this method verifies that the provided quantization algorithm is one of
* the three predefined algorithms in this class.
*
* @throws IllegalArgumentException If <code>args</code> is <code>null</code>.
* @throws IllegalArgumentException If <code>msg</code> is <code>null</code>
* and the validation fails.
*/
protected boolean validateParameters(String modeName,
ParameterBlock args,
StringBuffer msg) {
if ( args == null || msg == null ) {
throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
}
if (!super.validateParameters(modeName, args, msg))
return false;
ColorQuantizerType algorithm =
(ColorQuantizerType)args.getObjectParameter(0);
if (algorithm != MEDIANCUT && algorithm != NEUQUANT &&
algorithm != OCTTREE) {
msg.append(getName() + " " +
JaiI18N.getString("ColorQuantizerDescriptor7"));
return false;
}
Integer secondOne = (Integer)args.getObjectParameter(2);
if (secondOne == null) {
int upperBound = 0;
if (algorithm.equals(MEDIANCUT))
upperBound = 32768;
else if (algorithm.equals(NEUQUANT)) // set the cycle for train to 100
upperBound = 100;
else if (algorithm.equals(OCTTREE)) // set the maximum tree size to 65536
upperBound = 65536;
args.set(upperBound, 2);
}
return true;
}
示例9: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of an error diffusion operator according to the
* color map and error filter kernel.
*
* @param paramBlock The color map and error filter kernel objects.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
RenderedImage source = paramBlock.getRenderedSource(0);
LookupTableJAI lookupTable =
(LookupTableJAI)paramBlock.getObjectParameter(0);
KernelJAI kernel = (KernelJAI)paramBlock.getObjectParameter(1);
return new ErrorDiffusionOpImage(source, renderHints, layout,
lookupTable, kernel);
}
示例10: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* <p> Creates a new instance of SubsampleOpImage in the rendered layer.
* This method satisfies the implementation of RIF.
*
* @param paramBlock The source image, the X and Y scale factors.
* @param renderHints RenderingHints.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
RenderedImage source = paramBlock.getRenderedSource(0);
BorderExtender extender = renderHints == null ? null :
(BorderExtender)renderHints.get(JAI.KEY_BORDER_EXTENDER);
ImageLayout layout = renderHints == null ? null :
(ImageLayout)renderHints.get(JAI.KEY_IMAGE_LAYOUT);
int scaleX = paramBlock.getIntParameter(0);
int scaleY = paramBlock.getIntParameter(1);
float [] qsFilter = (float [])paramBlock.getObjectParameter(2);
Interpolation interp = (Interpolation)paramBlock.getObjectParameter(3);
// check if binary and interpolation type allowed
SampleModel sm = source.getSampleModel();
int dataType = sm.getDataType();
// Determine the interpolation type, if not supported throw exception
boolean validInterp = (interp instanceof InterpolationNearest) ||
(interp instanceof InterpolationBilinear) ||
(interp instanceof InterpolationBicubic) ||
(interp instanceof InterpolationBicubic2);
if (!validInterp)
throw new IllegalArgumentException(
JaiI18N.getString("FilteredSubsample3"));
return new FilteredSubsampleOpImage(source, extender, (Map)renderHints, layout,
scaleX, scaleY, qsFilter, interp);
}
示例11: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>PiecewiseOpImage</code> in the
* rendered layer.
*
* @param args The source image and the breakpoints.
* @param hints Optionally contains destination image layout.
*/
public RenderedImage create(ParameterBlock args,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
// Derive breakpoints from the histogram and specified CDF.
RenderedImage src = args.getRenderedSource(0);
Histogram hist = (Histogram)src.getProperty("histogram");
float[][] CDF = (float[][])args.getObjectParameter(0);
float[][][] bp = createSpecificationMap(hist, CDF);
return new PiecewiseOpImage(src, renderHints, layout, bp);
}
示例12: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>AddConstOpImage</code> in the
* rendered layer.
*
* @param args The source image and the constants.
* @param hints Optionally contains destination image layout.
*/
public RenderedImage create(ParameterBlock args,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
return new AddConstOpImage(args.getRenderedSource(0),
renderHints,
layout,
(double[])args.getObjectParameter(0));
}
示例13: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>MultiplyConstOpImage</code> in the
* rendered layer.
*
* @param args The source image and the constants.
* @param hints Optionally contains destination image layout.
*/
public RenderedImage create(ParameterBlock args,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
return new MultiplyConstOpImage(args.getRenderedSource(0),
renderHints,
layout,
(double[])args.getObjectParameter(0));
}
示例14: validateArguments
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/** Validates input source and parameter. */
public boolean validateArguments(String modeName,
ParameterBlock args,
StringBuffer msg) {
if (!super.validateArguments(modeName, args, msg)) {
return false;
}
Collection col = (Collection)args.getSource(0);
if (col.size() < 1) {
msg.append(getName() + " " +
JaiI18N.getString("AddConstToCollectionDescriptor2"));
return false;
}
Iterator iter = col.iterator();
while (iter.hasNext()) {
Object o = iter.next();
if (!(o instanceof RenderedImage)) {
msg.append(getName() + " " +
JaiI18N.getString("AddConstToCollectionDescriptor3"));
return false;
}
}
int length = ((double[])args.getObjectParameter(0)).length;
if (length < 1) {
msg.append(getName() + " " +
JaiI18N.getString("AddConstToCollectionDescriptor4"));
return false;
}
return true;
}
示例15: validateArguments
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Validates the input parameters.
*
* <p> In addition to the standard checks performed by the
* superclass method, this method checks that "shiftX" and
* "shiftY" are between 0 and the source image width and
* height, respectively.
*/
public boolean validateArguments(String modeName,
ParameterBlock args,
StringBuffer msg) {
if (!super.validateArguments(modeName, args, msg)) {
return false;
}
if (!modeName.equalsIgnoreCase("rendered"))
return true;
RenderedImage src = args.getRenderedSource(0);
// Set non-static default values based on source
if (args.getObjectParameter(0) == null) {
args.set(new Integer(src.getWidth()/2), 0);
}
if (args.getObjectParameter(1) == null) {
args.set(new Integer(src.getHeight()/2), 1);
}
int shiftX = args.getIntParameter(0);
int shiftY = args.getIntParameter(1);
if (shiftX < 0 || shiftX >= src.getWidth() ||
shiftY < 0 || shiftY >= src.getHeight()) {
msg.append(getName() + " " +
JaiI18N.getString("PeriodicShiftDescriptor3"));
return false;
}
return true;
}