當前位置: 首頁>>代碼示例>>Java>>正文


Java AffineTransform.shear方法代碼示例

本文整理匯總了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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:GetTypeOptimization.java

示例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);
}
 
開發者ID:defano,項目名稱:jmonet,代碼行數:12,代碼來源:Transform.java

示例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));
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:10,代碼來源:GraphicsTests.java

示例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);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:TestInvertMethods.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:TestRotateMethods.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:TestSerialization.java


注:本文中的java.awt.geom.AffineTransform.shear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。