本文整理匯總了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;
}