当前位置: 首页>>代码示例>>Java>>正文


Java AffineTransform.getShearY方法代码示例

本文整理汇总了Java中java.awt.geom.AffineTransform.getShearY方法的典型用法代码示例。如果您正苦于以下问题:Java AffineTransform.getShearY方法的具体用法?Java AffineTransform.getShearY怎么用?Java AffineTransform.getShearY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.AffineTransform的用法示例。


在下文中一共展示了AffineTransform.getShearY方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: concatfix

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public void concatfix(AffineTransform at) {
    double m00 = at.getScaleX();
    double m10 = at.getShearY();
    double m01 = at.getShearX();
    double m11 = at.getScaleY();
    double m02 = at.getTranslateX();
    double m12 = at.getTranslateY();
    if (Math.abs(m00-1.0) < 1E-10) m00 = 1.0;
    if (Math.abs(m11-1.0) < 1E-10) m11 = 1.0;
    if (Math.abs(m02) < 1E-10) m02 = 0.0;
    if (Math.abs(m12) < 1E-10) m12 = 0.0;
    if (Math.abs(m01) < 1E-15) m01 = 0.0;
    if (Math.abs(m10) < 1E-15) m10 = 0.0;
    at.setTransform(m00, m10,
                    m01, m11,
                    m02, m12);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:TestInvertMethods.java

示例2: deltaTransformConsumer

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static PathConsumer2D
    deltaTransformConsumer(PathConsumer2D out,
                           AffineTransform at)
{
    if (at == null) {
        return out;
    }
    float Mxx = (float) at.getScaleX();
    float Mxy = (float) at.getShearX();
    float Myx = (float) at.getShearY();
    float Myy = (float) at.getScaleY();
    if (Mxy == 0f && Myx == 0f) {
        if (Mxx == 1f && Myy == 1f) {
            return out;
        } else {
            return new DeltaScaleFilter(out, Mxx, Myy);
        }
    } else {
        return new DeltaTransformFilter(out, Mxx, Mxy, Myx, Myy);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:TransformingPathConsumer2D.java

示例3: inverseDeltaTransformConsumer

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static PathConsumer2D
    inverseDeltaTransformConsumer(PathConsumer2D out,
                                  AffineTransform at)
{
    if (at == null) {
        return out;
    }
    float Mxx = (float) at.getScaleX();
    float Mxy = (float) at.getShearX();
    float Myx = (float) at.getShearY();
    float Myy = (float) at.getScaleY();
    if (Mxy == 0f && Myx == 0f) {
        if (Mxx == 1f && Myy == 1f) {
            return out;
        } else {
            return new DeltaScaleFilter(out, 1.0f/Mxx, 1.0f/Myy);
        }
    } else {
        float det = Mxx * Myy - Mxy * Myx;
        return new DeltaTransformFilter(out,
                                        Myy / det,
                                        -Mxy / det,
                                        -Myx / det,
                                        Mxx / det);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:TransformingPathConsumer2D.java

示例4: inverseDeltaTransformConsumer

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
DPathConsumer2D inverseDeltaTransformConsumer(DPathConsumer2D out,
                                             AffineTransform at)
{
    if (at == null) {
        return out;
    }
    double mxx = at.getScaleX();
    double mxy = at.getShearX();
    double myx = at.getShearY();
    double myy = at.getScaleY();

    if (mxy == 0.0d && myx == 0.0d) {
        if (mxx == 1.0d && myy == 1.0d) {
            return out;
        } else {
            return iv_DeltaScaleFilter.init(out, 1.0d/mxx, 1.0d/myy);
        }
    } else {
        double det = mxx * myy - mxy * myx;
        return iv_DeltaTransformFilter.init(out,
                                            myy / det,
                                           -mxy / det,
                                           -myx / det,
                                            mxx / det);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:DTransformingPathConsumer2D.java

示例5: deltaTransformConsumer

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
DPathConsumer2D deltaTransformConsumer(DPathConsumer2D out,
                                      AffineTransform at)
{
    if (at == null) {
        return out;
    }
    double mxx = at.getScaleX();
    double mxy = at.getShearX();
    double myx = at.getShearY();
    double myy = at.getScaleY();

    if (mxy == 0.0d && myx == 0.0d) {
        if (mxx == 1.0d && myy == 1.0d) {
            return out;
        } else {
            return dt_DeltaScaleFilter.init(out, mxx, myy);
        }
    } else {
        return dt_DeltaTransformFilter.init(out, mxx, mxy, myx, myy);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:DTransformingPathConsumer2D.java

示例6: fillRectangle

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public void fillRectangle(SunGraphics2D sg2d,
                          double rx, double ry,
                          double rw, double rh)
{
    double px, py;
    double dx1, dy1, dx2, dy2;
    AffineTransform txform = sg2d.transform;
    dx1 = txform.getScaleX();
    dy1 = txform.getShearY();
    dx2 = txform.getShearX();
    dy2 = txform.getScaleY();
    px = rx * dx1 + ry * dx2 + txform.getTranslateX();
    py = rx * dy1 + ry * dy2 + txform.getTranslateY();
    dx1 *= rw;
    dy1 *= rw;
    dx2 *= rh;
    dy2 *= rh;
    if (adjustfill &&
        sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM &&
        sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE)
    {
        double newx = normalize(px);
        double newy = normalize(py);
        dx1 = normalize(px + dx1) - newx;
        dy1 = normalize(py + dy1) - newy;
        dx2 = normalize(px + dx2) - newx;
        dy2 = normalize(py + dy2) - newy;
        px = newx;
        py = newy;
    }
    outrenderer.fillParallelogram(sg2d, rx, ry, rx+rw, ry+rh,
                                  px, py, dx1, dy1, dx2, dy2);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:PixelToParallelogramConverter.java

示例7: matchTX

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private static boolean matchTX(double[] lhs, AffineTransform rhs) {
    return
        lhs[0] == rhs.getScaleX() &&
        lhs[1] == rhs.getShearY() &&
        lhs[2] == rhs.getShearX() &&
        lhs[3] == rhs.getScaleY();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:StandardGlyphVector.java

示例8: transformConsumer

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static PathConsumer2D
    transformConsumer(PathConsumer2D out,
                      AffineTransform at)
{
    if (at == null) {
        return out;
    }
    float Mxx = (float) at.getScaleX();
    float Mxy = (float) at.getShearX();
    float Mxt = (float) at.getTranslateX();
    float Myx = (float) at.getShearY();
    float Myy = (float) at.getScaleY();
    float Myt = (float) at.getTranslateY();
    if (Mxy == 0f && Myx == 0f) {
        if (Mxx == 1f && Myy == 1f) {
            if (Mxt == 0f && Myt == 0f) {
                return out;
            } else {
                return new TranslateFilter(out, Mxt, Myt);
            }
        } else {
            if (Mxt == 0f && Myt == 0f) {
                return new DeltaScaleFilter(out, Mxx, Myy);
            } else {
                return new ScaleFilter(out, Mxx, Myy, Mxt, Myt);
            }
        }
    } else if (Mxt == 0f && Myt == 0f) {
        return new DeltaTransformFilter(out, Mxx, Mxy, Myx, Myy);
    } else {
        return new TransformFilter(out, Mxx, Mxy, Mxt, Myx, Myy, Myt);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:TransformingPathConsumer2D.java

示例9: drawRectangle

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public void drawRectangle(SunGraphics2D sg2d,
                          double rx, double ry,
                          double rw, double rh,
                          double lw)
{
    double px, py;
    double dx1, dy1, dx2, dy2;
    double lw1, lw2;
    AffineTransform txform = sg2d.transform;
    dx1 = txform.getScaleX();
    dy1 = txform.getShearY();
    dx2 = txform.getShearX();
    dy2 = txform.getScaleY();
    px = rx * dx1 + ry * dx2 + txform.getTranslateX();
    py = rx * dy1 + ry * dy2 + txform.getTranslateY();
    // lw along dx1,dy1 scale by transformed length of dx2,dy2 vectors
    // and vice versa
    lw1 = len(dx1, dy1) * lw;
    lw2 = len(dx2, dy2) * lw;
    dx1 *= rw;
    dy1 *= rw;
    dx2 *= rh;
    dy2 *= rh;
    if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM &&
        sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE)
    {
        double newx = normalize(px);
        double newy = normalize(py);
        dx1 = normalize(px + dx1) - newx;
        dy1 = normalize(py + dy1) - newy;
        dx2 = normalize(px + dx2) - newx;
        dy2 = normalize(py + dy2) - newy;
        px = newx;
        py = newy;
    }
    lw1 = Math.max(lw1, minPenSize);
    lw2 = Math.max(lw2, minPenSize);
    double len1 = len(dx1, dy1);
    double len2 = len(dx2, dy2);
    if (lw1 >= len1 || lw2 >= len2) {
        // The line widths are large enough to consume the
        // entire hole in the middle of the parallelogram
        // so we can just fill the outer parallelogram.
        fillOuterParallelogram(sg2d,
                               rx, ry, rx+rw, ry+rh,
                               px, py, dx1, dy1, dx2, dy2,
                               len1, len2, lw1, lw2);
    } else {
        outrenderer.drawParallelogram(sg2d,
                                      rx, ry, rx+rw, ry+rh,
                                      px, py, dx1, dy1, dx2, dy2,
                                      lw1 / len1, lw2 / len2);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:55,代码来源:PixelToParallelogramConverter.java

示例10: equalNonTranslateTX

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private static boolean equalNonTranslateTX(AffineTransform lhs, AffineTransform rhs) {
    return lhs.getScaleX() == rhs.getScaleX() &&
        lhs.getShearY() == rhs.getShearY() &&
        lhs.getShearX() == rhs.getShearX() &&
        lhs.getScaleY() == rhs.getScaleY();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:StandardGlyphVector.java

示例11: userSpaceLineWidth

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private float userSpaceLineWidth(AffineTransform at, float lw) {

        double widthScale;

        if ((at.getType() & (AffineTransform.TYPE_GENERAL_TRANSFORM |
                            AffineTransform.TYPE_GENERAL_SCALE)) != 0) {
            widthScale = Math.sqrt(at.getDeterminant());
        } else {
            /* First calculate the "maximum scale" of this transform. */
            double A = at.getScaleX();       // m00
            double C = at.getShearX();       // m01
            double B = at.getShearY();       // m10
            double D = at.getScaleY();       // m11

            /*
             * Given a 2 x 2 affine matrix [ A B ] such that
             *                             [ C D ]
             * v' = [x' y'] = [Ax + Cy, Bx + Dy], we want to
             * find the maximum magnitude (norm) of the vector v'
             * with the constraint (x^2 + y^2 = 1).
             * The equation to maximize is
             *     |v'| = sqrt((Ax+Cy)^2+(Bx+Dy)^2)
             * or  |v'| = sqrt((AA+BB)x^2 + 2(AC+BD)xy + (CC+DD)y^2).
             * Since sqrt is monotonic we can maximize |v'|^2
             * instead and plug in the substitution y = sqrt(1 - x^2).
             * Trigonometric equalities can then be used to get
             * rid of most of the sqrt terms.
             */

            double EA = A*A + B*B;          // x^2 coefficient
            double EB = 2*(A*C + B*D);      // xy coefficient
            double EC = C*C + D*D;          // y^2 coefficient

            /*
             * There is a lot of calculus omitted here.
             *
             * Conceptually, in the interests of understanding the
             * terms that the calculus produced we can consider
             * that EA and EC end up providing the lengths along
             * the major axes and the hypot term ends up being an
             * adjustment for the additional length along the off-axis
             * angle of rotated or sheared ellipses as well as an
             * adjustment for the fact that the equation below
             * averages the two major axis lengths.  (Notice that
             * the hypot term contains a part which resolves to the
             * difference of these two axis lengths in the absence
             * of rotation.)
             *
             * In the calculus, the ratio of the EB and (EA-EC) terms
             * ends up being the tangent of 2*theta where theta is
             * the angle that the long axis of the ellipse makes
             * with the horizontal axis.  Thus, this equation is
             * calculating the length of the hypotenuse of a triangle
             * along that axis.
             */

            double hypot = Math.sqrt(EB*EB + (EA-EC)*(EA-EC));
            /* sqrt omitted, compare to squared limits below. */
            double widthsquared = ((EA + EC + hypot)/2.0);

            widthScale = Math.sqrt(widthsquared);
        }

        return (float) (lw / widthScale);
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:66,代码来源:PiscesRenderingEngine.java

示例12: userSpaceLineWidth

import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private final double userSpaceLineWidth(AffineTransform at, double lw) {

        double widthScale;

        if (at == null) {
            widthScale = 1.0d;
        } else if ((at.getType() & (AffineTransform.TYPE_GENERAL_TRANSFORM  |
                                    AffineTransform.TYPE_GENERAL_SCALE)) != 0) {
            widthScale = Math.sqrt(at.getDeterminant());
        } else {
            // First calculate the "maximum scale" of this transform.
            double A = at.getScaleX();       // m00
            double C = at.getShearX();       // m01
            double B = at.getShearY();       // m10
            double D = at.getScaleY();       // m11

            /*
             * Given a 2 x 2 affine matrix [ A B ] such that
             *                             [ C D ]
             * v' = [x' y'] = [Ax + Cy, Bx + Dy], we want to
             * find the maximum magnitude (norm) of the vector v'
             * with the constraint (x^2 + y^2 = 1).
             * The equation to maximize is
             *     |v'| = sqrt((Ax+Cy)^2+(Bx+Dy)^2)
             * or  |v'| = sqrt((AA+BB)x^2 + 2(AC+BD)xy + (CC+DD)y^2).
             * Since sqrt is monotonic we can maximize |v'|^2
             * instead and plug in the substitution y = sqrt(1 - x^2).
             * Trigonometric equalities can then be used to get
             * rid of most of the sqrt terms.
             */

            double EA = A*A + B*B;          // x^2 coefficient
            double EB = 2.0d * (A*C + B*D); // xy coefficient
            double EC = C*C + D*D;          // y^2 coefficient

            /*
             * There is a lot of calculus omitted here.
             *
             * Conceptually, in the interests of understanding the
             * terms that the calculus produced we can consider
             * that EA and EC end up providing the lengths along
             * the major axes and the hypot term ends up being an
             * adjustment for the additional length along the off-axis
             * angle of rotated or sheared ellipses as well as an
             * adjustment for the fact that the equation below
             * averages the two major axis lengths.  (Notice that
             * the hypot term contains a part which resolves to the
             * difference of these two axis lengths in the absence
             * of rotation.)
             *
             * In the calculus, the ratio of the EB and (EA-EC) terms
             * ends up being the tangent of 2*theta where theta is
             * the angle that the long axis of the ellipse makes
             * with the horizontal axis.  Thus, this equation is
             * calculating the length of the hypotenuse of a triangle
             * along that axis.
             */

            double hypot = Math.sqrt(EB*EB + (EA-EC)*(EA-EC));
            // sqrt omitted, compare to squared limits below.
            double widthsquared = ((EA + EC + hypot) / 2.0d);

            widthScale = Math.sqrt(widthsquared);
        }

        return (lw / widthScale);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:68,代码来源:DMarlinRenderingEngine.java


注:本文中的java.awt.geom.AffineTransform.getShearY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。