本文整理汇总了Java中java.awt.geom.AffineTransform.shear方法的典型用法代码示例。如果您正苦于以下问题:Java AffineTransform.shear方法的具体用法?Java AffineTransform.shear怎么用?Java AffineTransform.shear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.AffineTransform
的用法示例。
在下文中一共展示了AffineTransform.shear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeRandomTransform
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static AffineTransform makeRandomTransform(int numops) {
AffineTransform at = new AffineTransform();
while (--numops >= 0) {
switch (rand.nextInt(4)) {
case 0:
at.scale(rand.nextDouble() * 5 - 2.5,
rand.nextDouble() * 5 - 2.5);
break;
case 1:
at.shear(rand.nextDouble() * 5 - 2.5,
rand.nextDouble() * 5 - 2.5);
break;
case 2:
at.rotate(rand.nextDouble() * Math.PI * 2);
break;
case 3:
at.translate(rand.nextDouble() * 50 - 25,
rand.nextDouble() * 50 - 25);
break;
default:
throw new InternalError("bad case!");
}
}
return at;
}
示例2: slant
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static BufferedImage slant(BufferedImage image, FlexQuadrilateral quadrilateral, int xTranslation) {
Point p = new Point(quadrilateral.getBottomLeft().x, quadrilateral.getTopLeft().y);
double theta = Geometry.theta(quadrilateral.getBottomLeft(), p, quadrilateral.getTopLeft());
AffineTransform transform = AffineTransform.getTranslateInstance(xTranslation, 0);
transform.shear(Math.tan(theta), 0);
transform.translate(xTranslation, 0);
AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
return op.filter(image, null);
}
示例3: init
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
int w = dim.width;
int h = dim.height;
AffineTransform at = new AffineTransform();
at.translate(0.0, (h - (w*h)/(w + h*0.1)) / 2);
at.shear(0.1, 0.0);
g2d.transform(at);
dim.setSize(scaleForTransform(at, dim));
}
示例4: test
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public void test(AffineTransform init, Tester next, boolean full) {
double shears[] = (full ? fullvals : abbrevvals);
for (int i = 0; i < shears.length; i += 2) {
AffineTransform at2 = new AffineTransform(init);
at2.shear(shears[i], shears[i+1]);
if (verbose) System.out.println("*Shear("+shears[i]+", "+
shears[i+1]+") = "+at2);
next.test(at2, full);
}
}
示例5: makeRandomAT
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static AffineTransform makeRandomAT() {
AffineTransform at = new AffineTransform();
at.scale(Math.random() * -10.0, Math.random() * 100.0);
at.rotate(Math.random() * Math.PI);
at.shear(Math.random(), Math.random());
at.translate(Math.random() * 300.0, Math.random() * -20.0);
return at;
}
示例6: makeComplexAT
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static AffineTransform makeComplexAT() {
AffineTransform at = new AffineTransform();
at.scale(2.5, -3.0);
at.rotate(Math.PI / 4.0);
at.shear(1.0, -3.0);
at.translate(25.0, 12.5);
return at;
}