本文整理汇总了Java中javax.media.jai.Interpolation.INTERP_BILINEAR属性的典型用法代码示例。如果您正苦于以下问题:Java Interpolation.INTERP_BILINEAR属性的具体用法?Java Interpolation.INTERP_BILINEAR怎么用?Java Interpolation.INTERP_BILINEAR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.media.jai.Interpolation
的用法示例。
在下文中一共展示了Interpolation.INTERP_BILINEAR属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: interpolationToByte
protected static byte interpolationToByte(
final Interpolation interpolation ) {
// this is silly because it seems like a translation JAI should provide,
// but it seems its not provided and its the most efficient approach
// (rather than serializing class names)
if (interpolation instanceof InterpolationNearest) {
return Interpolation.INTERP_NEAREST;
}
if (interpolation instanceof InterpolationBilinear) {
return Interpolation.INTERP_BILINEAR;
}
if (interpolation instanceof InterpolationBicubic2) {
return Interpolation.INTERP_BICUBIC_2;
}
return Interpolation.INTERP_BICUBIC;
}
示例2: getResampleType
private int getResampleType() {
final int resamplingType;
if ("Nearest".equalsIgnoreCase(resamplingName)) {
resamplingType = Interpolation.INTERP_NEAREST;
} else if ("Bilinear".equalsIgnoreCase(resamplingName)) {
resamplingType = Interpolation.INTERP_BILINEAR;
} else if ("Bicubic".equalsIgnoreCase(resamplingName)) {
resamplingType = Interpolation.INTERP_BICUBIC;
} else {
resamplingType = -1;
}
return resamplingType;
}
示例3: getInterpolationType
private static int getInterpolationType(String interpolationString) {
final int interpolationType;
if ("Nearest".equalsIgnoreCase(interpolationString)) {
interpolationType = Interpolation.INTERP_NEAREST;
} else if ("Bilinear".equalsIgnoreCase(interpolationString)) {
interpolationType = Interpolation.INTERP_BILINEAR;
} else if ("Bicubic".equalsIgnoreCase(interpolationString)) {
interpolationType = Interpolation.INTERP_BICUBIC;
} else {
interpolationType = -1;
}
return interpolationType;
}
示例4: combineFilters
/** <p> <code>combineFilters</code> based on <code>resampleType</code> and
* input partial <code>qsFilter</code> (see above for details on qsFilter format).
* Input <code>qsFilter</code> is restricted to have odd parity
* (<code>qsFilter[0]</code> is at the center of the kernel).
*
* @param scaleFactor positive int representing the downsample factor.
* @param resampleType int representing the interpolation type.
* @param qsFilter floating partial kernel array (antialias filter).
* @return floating partial kernel representing combined resample and qsFilter.
*/
private static float [] combineFilters(int scaleFactor,
int resampleType,
float [] qsFilter) {
// Odd scale factors imply no resample filter is required
// return pointer to the qsFilter
if ((scaleFactor%2) == 1) return (float [])qsFilter.clone();
int qsParity = 1;
int resampParity = 0; // Unless nearest neighbor case is selected (ignored)
switch (resampleType) {
case Interpolation.INTERP_NEAREST: // Return a copy of the qsFilter
return (float [])qsFilter.clone();
case Interpolation.INTERP_BILINEAR: // 2 by 2 resample filter
float [] bilinearKernel = { 1.0F/2.0F };
return convolveSymmetricKernels(
qsParity, resampParity, qsFilter, bilinearKernel);
case Interpolation.INTERP_BICUBIC: // 4 by 4 resample filter
float [] bicubicKernel = { 9.0F/16.0F, -1.0F/16.0F };
return convolveSymmetricKernels(
qsParity, resampParity, qsFilter, bicubicKernel);
case Interpolation.INTERP_BICUBIC_2: // alternate 4 by 4 resample filter
float [] bicubic2Kernel = { 5.0F/8.0F, -1.0F/8.0F };
return convolveSymmetricKernels(
qsParity, resampParity, qsFilter, bicubic2Kernel);
default:
throw new IllegalArgumentException(
JaiI18N.getString("FilteredSubsample0"));
}
}
示例5: FilteredSubsampleOpImage
/** <p> <code>FilteredSubsampleOpImage</code> constructs an OpImage representing
* filtered integral subsampling. The scale factors represent the ratio of
* source to destination dimensions.
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param config a Map object possibly holding tile cache information
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param interp a Interpolation object to use for resampling.
* @param scaleX downsample factor along x axis.
* @param scaleY downsample factor along y axis.
* @param qsFilter symmetric filter coefficients (partial kernel).
* @throws IllegalArgumentException if the interp type is not one of:
* INTERP_NEAREST, INTERP_BILINEAR, INTERP_BICUBIC, or INTERP_BICUBIC_2
*/
public FilteredSubsampleOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
int scaleX,
int scaleY,
float [] qsFilter,
Interpolation interp) {
// Propagate to GeometricOpImage constructor
super(vectorize(source),
layoutHelper(source, interp, scaleX, scaleY, qsFilter.length, layout),
config, // Map object
true, // cobbleSources,
extender, // extender
interp, // Interpolation object
null);
int resampleType;
// Determine the interpolation type, if not supported throw exception
if (interp instanceof InterpolationNearest) {
resampleType = Interpolation.INTERP_NEAREST;
} else if (interp instanceof InterpolationBilinear) {
resampleType = Interpolation.INTERP_BILINEAR;
} else if (interp instanceof InterpolationBicubic) {
resampleType = Interpolation.INTERP_BICUBIC;
} else if (interp instanceof InterpolationBicubic2) {
resampleType = Interpolation.INTERP_BICUBIC_2;
} else {
throw new IllegalArgumentException(
JaiI18N.getString("FilteredSubsample3"));
}
// Construct combined anti-alias and resample kernels.
this.hParity = filterParity(scaleX,resampleType);
this.vParity = filterParity(scaleY,resampleType);
this.hKernel = combineFilters(scaleX,resampleType,qsFilter);
this.vKernel = combineFilters(scaleY,resampleType,qsFilter);
this.scaleX = scaleX;
this.scaleY = scaleY;
}