本文整理汇总了Java中javax.media.jai.operator.ShearDir类的典型用法代码示例。如果您正苦于以下问题:Java ShearDir类的具体用法?Java ShearDir怎么用?Java ShearDir使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ShearDir类属于javax.media.jai.operator包,在下文中一共展示了ShearDir类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import javax.media.jai.operator.ShearDir; //导入依赖的package包/类
public static String call(PageContext pc, Object name, double shear, String strDirection, String strInterpolation) throws PageException {
//if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc,name);
// direction
strDirection=strDirection.toLowerCase().trim();
ShearDir direction;
if("horizontal".equals(strDirection)) direction = ShearDescriptor.SHEAR_HORIZONTAL;
else if("vertical".equals(strDirection)) direction = ShearDescriptor.SHEAR_VERTICAL;
else throw new FunctionException(pc,"ImageShear",3,"direction","invalid direction definition ["+strDirection+"], " +
"valid direction values are [horizontal,vertical]");
// interpolation
strInterpolation=strInterpolation.toLowerCase().trim();
Object interpolation = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
if("nearest".equals(strInterpolation)) interpolation = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
else if("bilinear".equals(strInterpolation)) interpolation = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
else if("bicubic".equals(strInterpolation)) interpolation = RenderingHints.VALUE_INTERPOLATION_BICUBIC;
else throw new FunctionException(pc,"ImageTranslate",4,"interpolation","invalid interpolation definition ["+strInterpolation+"], " +
"valid interpolation values are [nearest,bilinear,bicubic]");
img.shear((float)shear, direction, interpolation);
return null;
}
示例2: create
import javax.media.jai.operator.ShearDir; //导入依赖的package包/类
/**
* Shears an image.
*
* <p>Creates a <code>ParameterBlockJAI</code> from all
* supplied arguments except <code>hints</code> and invokes
* {@link JAI#create(String,ParameterBlock,RenderingHints)}.
*
* @see JAI
* @see ParameterBlockJAI
* @see RenderedOp
*
* @param source0 <code>RenderedImage</code> source 0.
* @param shear The shear value.
* May be <code>null</code>.
* @param shearDir The shear direction.
* May be <code>null</code>.
* @param xTrans The X translation.
* May be <code>null</code>.
* @param yTrans The Y translation.
* May be <code>null</code>.
* @param interpolation The interpolation method for resampling.
* May be <code>null</code>.
* @param backgroundValues The user-specified background values.
* May be <code>null</code>.
* @param hints The <code>RenderingHints</code> to use.
* May be <code>null</code>.
* @return The <code>RenderedOp</code> destination.
* @throws IllegalArgumentException if <code>source0</code> is <code>null</code>.
*/
public static RenderedOp create(RenderedImage source0,
Float shear,
ShearDir shearDir,
Float xTrans,
Float yTrans,
Interpolation interpolation,
double[] backgroundValues,
RenderingHints hints) {
ParameterBlockJAI pb =
new ParameterBlockJAI("Shear",
RenderedRegistryMode.MODE_NAME);
pb.setSource("source0", source0);
pb.setParameter("shear", shear);
pb.setParameter("shearDir", shearDir);
pb.setParameter("xTrans", xTrans);
pb.setParameter("yTrans", yTrans);
pb.setParameter("interpolation", interpolation);
pb.setParameter("backgroundValues", backgroundValues);
return JAI.create("Shear", pb, hints);
}