本文整理汇总了Java中java.awt.image.renderable.ParameterBlock.getIntParameter方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterBlock.getIntParameter方法的具体用法?Java ParameterBlock.getIntParameter怎么用?Java ParameterBlock.getIntParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.renderable.ParameterBlock
的用法示例。
在下文中一共展示了ParameterBlock.getIntParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>HistogramOpImage</code>
* in the rendered layer. Any image layout information in
* <code>RenderingHints</code> is ignored.
* This method satisfies the implementation of RIF.
*/
public RenderedImage create(ParameterBlock args,
RenderingHints hints) {
RenderedImage src = args.getRenderedSource(0);
int xStart = src.getMinX(); // default values
int yStart = src.getMinY();
int maxWidth = src.getWidth();
int maxHeight = src.getHeight();
ROI roi = (ROI)args.getObjectParameter(0);
int xPeriod = args.getIntParameter(1);
int yPeriod = args.getIntParameter(2);
int[] numBins = (int[])args.getObjectParameter(3);
double[] lowValue = (double[])args.getObjectParameter(4);
double[] highValue = (double[])args.getObjectParameter(5);
HistogramOpImage op = null;
try {
op = new HistogramOpImage(src,
roi,
xStart, yStart,
xPeriod, yPeriod,
numBins, lowValue, highValue);
} catch (Exception e) {
ImagingListener listener = ImageUtil.getImagingListener(hints);
String message = JaiI18N.getString("HistogramRIF0");
listener.errorOccurred(message, e, this, false);
}
return op;
}
示例2: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>MeanOpImage</code>
* in the rendered layer. Any image layout information in
* <code>RenderingHints</code> is ignored.
* This method satisfies the implementation of RIF.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
RenderedImage src = paramBlock.getRenderedSource(0);
int xStart = src.getMinX(); // default values
int yStart = src.getMinY();
int maxWidth = src.getWidth();
int maxHeight = src.getHeight();
return new MeanOpImage(src,
(ROI)paramBlock.getObjectParameter(0),
xStart, yStart,
paramBlock.getIntParameter(1),
paramBlock.getIntParameter(2));
}
示例3: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>ExtremaOpImage</code>
* in the rendered layer. Any image layout information in
* <code>RenderingHints</code> is ignored.
* This method satisfies the implementation of RIF.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints hints) {
RenderedImage src = paramBlock.getRenderedSource(0);
int xStart = src.getMinX(); // default values
int yStart = src.getMinY();
int maxWidth = src.getWidth();
int maxHeight = src.getHeight();
return new ExtremaOpImage(src,
(ROI)paramBlock.getObjectParameter(0),
xStart, yStart,
paramBlock.getIntParameter(1),
paramBlock.getIntParameter(2),
((Boolean)paramBlock.getObjectParameter(3)).booleanValue(),
paramBlock.getIntParameter(4));
}
示例4: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of <code>PeriodicShiftOpImage</code>
* in the rendered layer. This method satisfies the
* implementation of RIF.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
// Get the source image.
RenderedImage source = paramBlock.getRenderedSource(0);
// Get the translation parameters.
int shiftX = paramBlock.getIntParameter(0);
int shiftY = paramBlock.getIntParameter(1);
// Return the OpImage.
return new PeriodicShiftOpImage(source, renderHints, layout, shiftX, shiftY);
}
示例5: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of PatternOpImage in the rendered layer.
* This method satisfies the implementation of RIF.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
int minX = 0;
int minY = 0;
if (layout != null) {
if (layout.isValid(ImageLayout.MIN_X_MASK)) {
minX = layout.getMinX(null);
}
if (layout.isValid(ImageLayout.MIN_Y_MASK)) {
minY = layout.getMinY(null);
}
}
RenderedImage source = (RenderedImage)paramBlock.getSource(0);
Raster pattern = source.getData();
ColorModel colorModel = source.getColorModel();
// Get image width and height from the parameter block
int width = paramBlock.getIntParameter(0);
int height = paramBlock.getIntParameter(1);
return new PatternOpImage(pattern, colorModel,
minX, minY, width, height);
}
示例6: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Create a new instance of SeparableConvolveOpImage in the rendered layer.
* This method satisfies the implementation of RIF.
*
* @param paramBlock The source image and the convolution kernel.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
// Get BorderExtender from renderHints if any.
BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);
// Get the operation parameters.
int width = paramBlock.getIntParameter(0);
int height = paramBlock.getIntParameter(1);
int xOrigin = paramBlock.getIntParameter(2);
int yOrigin = paramBlock.getIntParameter(3);
// Allocate and initialize arrays.
float[] dataH = new float[width];
Arrays.fill(dataH, 1.0F/(float)width);
float[] dataV = null;
if(height == width) {
dataV = dataH;
} else {
dataV = new float[height];
Arrays.fill(dataV, 1.0F/(float)height);
}
// Construct a separable kernel.
KernelJAI kernel = new KernelJAI(width, height, xOrigin, yOrigin,
dataH, dataV);
// Construct and return the OpImage.
return new SeparableConvolveOpImage(paramBlock.getRenderedSource(0),
extender,
renderHints,
layout,
kernel);
}
示例7: 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);
}
示例8: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* 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 args,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
RenderedImage source = args.getRenderedSource(0);
int leftPad = args.getIntParameter(0);
int rightPad = args.getIntParameter(1);
int topPad = args.getIntParameter(2);
int bottomPad = args.getIntParameter(3);
BorderExtender type =
(BorderExtender)args.getObjectParameter(4);
if (type ==
BorderExtender.createInstance(BorderExtender.BORDER_WRAP)) {
int minX = source.getMinX() - leftPad;
int minY = source.getMinY() - topPad;
int width = source.getWidth() + leftPad + rightPad;
int height = source.getHeight() + topPad + bottomPad;
return new PatternOpImage(source.getData(),
source.getColorModel(),
minX, minY,
width, height);
} else {
return new BorderOpImage(source, renderHints, layout,
leftPad, rightPad, topPad, bottomPad,
type);
}
}
示例9: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* <p> Creates a new instance of ColorQuantizerOpImage in the
* rendered layer. This method satisfies the implementation of RIF.
*
* @param paramBlock The source image, the color quantization algorithm
* name, the maximum number of colors, the
* parameter for training (the histogram size for
* median-cut, the cycle for neuquant, and maximum tree
* size for oct-tree), and the ROI.
* @param renderHints RenderingHints.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
RenderedImage source = paramBlock.getRenderedSource(0);
ImageLayout layout = renderHints == null ? null :
(ImageLayout)renderHints.get(JAI.KEY_IMAGE_LAYOUT);
ColorQuantizerType algorithm =
(ColorQuantizerType)paramBlock.getObjectParameter(0);
int maxColorNum = paramBlock.getIntParameter(1);
int upperBound = paramBlock.getIntParameter(2);
ROI roi= (ROI)paramBlock.getObjectParameter(3);
int xPeriod = paramBlock.getIntParameter(4);
int yPeriod = paramBlock.getIntParameter(5);
// check if 3-band byte-type image
SampleModel sm = source.getSampleModel();
if (sm.getNumBands() != 3 && sm.getDataType() == DataBuffer.TYPE_BYTE)
throw new IllegalArgumentException("ColorQuantizerRIF0");
if (algorithm.equals(ColorQuantizerDescriptor.NEUQUANT))
return new NeuQuantOpImage(source, (Map)renderHints, layout,
maxColorNum, upperBound, roi,
xPeriod, yPeriod);
if (algorithm.equals(ColorQuantizerDescriptor.OCTTREE))
return new OctTreeOpImage(source, (Map)renderHints, layout,
maxColorNum, upperBound, roi,
xPeriod, yPeriod);
else
return new MedianCutOpImage(source, (Map)renderHints, layout,
maxColorNum, upperBound, roi,
xPeriod, yPeriod);
}
示例10: 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;
}
示例11: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Create a new instance of MinFilterOpImage in the rendered layer.
* This method satisfies the implementation of RIF.
*
* @param paramBlock The source image and the convolution kernel.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
// Get BorderExtender from renderHints if any.
BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);
MinFilterShape maskType =
(MinFilterShape)paramBlock.getObjectParameter(0);
int maskSize = paramBlock.getIntParameter(1);
RenderedImage ri = paramBlock.getRenderedSource(0);
if(maskType.equals(MinFilterDescriptor.MIN_MASK_SQUARE)) {
return new MinFilterSquareOpImage(ri,
extender,
renderHints,
layout,
maskSize);
} else if(maskType.equals(MinFilterDescriptor.MIN_MASK_PLUS)) {
return new MinFilterPlusOpImage(ri,
extender,
renderHints,
layout,
maskSize);
} else if(maskType.equals(MinFilterDescriptor.MIN_MASK_X)) {
return new MinFilterXOpImage(ri,
extender,
renderHints,
layout,
maskSize);
} else if(maskType.equals(MinFilterDescriptor.MIN_MASK_SQUARE_SEPARABLE)) {
return new MinFilterSeparableOpImage(ri,
extender,
renderHints,
layout,
maskSize);
}
return null;
}
示例12: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Create a new instance of MedianFilterOpImage in the rendered layer.
* This method satisfies the implementation of RIF.
*
* @param paramBlock The source image and the convolution kernel.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
// Get BorderExtender from renderHints if any.
BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);
MedianFilterShape maskType =
(MedianFilterShape)paramBlock.getObjectParameter(0);
int maskSize = paramBlock.getIntParameter(1);
RenderedImage ri = paramBlock.getRenderedSource(0);
if(maskType.equals(MedianFilterDescriptor.MEDIAN_MASK_SQUARE)) {
return new MedianFilterSquareOpImage(ri,
extender,
renderHints,
layout,
maskSize);
} else if(maskType.equals(MedianFilterDescriptor.MEDIAN_MASK_PLUS)) {
return new MedianFilterPlusOpImage(ri,
extender,
renderHints,
layout,
maskSize);
} else if(maskType.equals(MedianFilterDescriptor.MEDIAN_MASK_X)) {
return new MedianFilterXOpImage(ri,
extender,
renderHints,
layout,
maskSize);
} else if(maskType.equals(MedianFilterDescriptor.MEDIAN_MASK_SQUARE_SEPARABLE)) {
return new MedianFilterSeparableOpImage(ri,
extender,
renderHints,
layout,
maskSize);
}
return null;
}
示例13: createRenderable
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a RenderableImage pyramid from the source and parameters.
* If the down sampler operation chain does not decrease both the
* width and height at a given level an IllegalArgumentException will
* be thrown.
*
* @param paramBlock The ParameterBlock containing a single RenderedImage
* source and parameters sufficient to create an image pyramid.
*/
private RenderableImage createRenderable(ParameterBlock paramBlock) {
// Create the Hashtable "just in time".
if(mresTable == null) {
mresTable = new Hashtable();
}
// Check for a SoftReference hashed on a ParameterBlock-derived key.
Object key = getKey(paramBlock);
SoftReference ref = (SoftReference)mresTable.get(key);
// Retrieve the image from the SoftReference if possible.
RenderableImage mres = null;
if(ref != null && (mres = (RenderableImage)ref.get()) == null) {
// null referent: remove the ParameterBlock key from the Hashtable.
mresTable.remove(key);
}
// Derive the image if necessary.
if(mres == null) {
// Retrieve the source and parameters.
RenderedImage source = paramBlock.getRenderedSource(0);
RenderedOp downSampler =
(RenderedOp)paramBlock.getObjectParameter(0);
int maxLowResDim = paramBlock.getIntParameter(1);
float minX = paramBlock.getFloatParameter(2);
float minY = paramBlock.getFloatParameter(3);
float height = paramBlock.getFloatParameter(4);
// Create an image pyramid.
ImageMIPMap pyramid = new ImageMIPMap(source, downSampler);
// Create a Vector of RenderedImages from the pyramid.
Vector sourceVector = new Vector();
RenderedImage currentImage = pyramid.getCurrentImage();
sourceVector.add(currentImage);
while(currentImage.getWidth() > maxLowResDim ||
currentImage.getHeight() > maxLowResDim) {
RenderedImage nextImage = pyramid.getDownImage();
if(nextImage.getWidth() >= currentImage.getWidth() ||
nextImage.getHeight() >= currentImage.getHeight()) {
throw new IllegalArgumentException(JaiI18N.getString("RenderableCRIF0"));
}
sourceVector.add(nextImage);
currentImage = nextImage;
}
// Create a RenderableImage
mres = new MultiResolutionRenderableImage(sourceVector,
minX, minY, height);
// Store a SoftReference to the RenderableImage in the Hashtable.
mresTable.put(key, new SoftReference(mres));
}
return mres;
}
示例14: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Create a new instance of MaxFilterOpImage in the rendered layer.
* This method satisfies the implementation of RIF.
*
* @param paramBlock The source image and the convolution kernel.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
// Get BorderExtender from renderHints if any.
BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);
MaxFilterShape maskType =
(MaxFilterShape)paramBlock.getObjectParameter(0);
int maskSize = paramBlock.getIntParameter(1);
RenderedImage ri = paramBlock.getRenderedSource(0);
if(maskType.equals(MaxFilterDescriptor.MAX_MASK_SQUARE)) {
return new MaxFilterSquareOpImage(ri,
extender,
renderHints,
layout,
maskSize);
} else if(maskType.equals(MaxFilterDescriptor.MAX_MASK_PLUS)) {
return new MaxFilterPlusOpImage(ri,
extender,
renderHints,
layout,
maskSize);
} else if(maskType.equals(MaxFilterDescriptor.MAX_MASK_X)) {
return new MaxFilterXOpImage(ri,
extender,
renderHints,
layout,
maskSize);
} else if(maskType.equals(MaxFilterDescriptor.MAX_MASK_SQUARE_SEPARABLE)) {
return new MaxFilterSeparableOpImage(ri,
extender,
renderHints,
layout,
maskSize);
}
return null;
}
示例15: create
import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
* Creates a new instance of ImageFunctionOpImage in the rendered layer.
* This method satisfies the implementation of RIF.
*
* @param paramBlock The source image, the X and Y scale factor,
* and the interpolation method for resampling.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
ImageFunction function =
(ImageFunction)paramBlock.getObjectParameter(0);
// Ascertain that a supplied SampleModel has the requisite
// number of bands vis-a-vis the ImageFunction.
int numBandsRequired = function.isComplex() ?
function.getNumElements() * 2 : function.getNumElements();
if(layout != null &&
layout.isValid(ImageLayout.SAMPLE_MODEL_MASK) &&
layout.getSampleModel(null).getNumBands() != numBandsRequired ) {
throw new RuntimeException(JaiI18N.getString("ImageFunctionRIF0"));
}
int minX = 0;
int minY = 0;
if (layout != null) {
if (layout.isValid(ImageLayout.MIN_X_MASK)) {
minX = layout.getMinX(null);
}
if (layout.isValid(ImageLayout.MIN_Y_MASK)) {
minY = layout.getMinX(null);
}
}
int width = paramBlock.getIntParameter(1);
int height = paramBlock.getIntParameter(2);
float xScale = paramBlock.getFloatParameter(3);
float yScale = paramBlock.getFloatParameter(4);
float xTrans = paramBlock.getFloatParameter(5);
float yTrans = paramBlock.getFloatParameter(6);
return new ImageFunctionOpImage(function,
minX, minY,
width, height,
xScale, yScale,
xTrans, yTrans,
renderHints, layout);
}