当前位置: 首页>>代码示例>>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;未经允许,请勿转载。