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


Java AffineTransform.TYPE_UNIFORM_SCALE属性代码示例

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


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

示例1: getNativePointSize

private int getNativePointSize() {
    /* Make a copy of the glyphTX in which we will store the
     * font transform, inverting the devTx if necessary
     */
    double[] mat = new double[4];
    desc.glyphTx.getMatrix(mat);
    fontTx = new AffineTransform(mat);

    /* Now work backwards to get the font transform */
    if (!desc.devTx.isIdentity() &&
        desc.devTx.getType() != AffineTransform.TYPE_TRANSLATION) {
        try {
            invertDevTx = desc.devTx.createInverse();
            fontTx.concatenate(invertDevTx);
        } catch (NoninvertibleTransformException e) {
            e.printStackTrace();
        }
    }

    /* At this point the fontTx may be a simple +ve scale, or it
     * may be something more complex.
     */
    Point2D.Float pt = new Point2D.Float(1f,1f);
    fontTx.deltaTransform(pt, pt);
    double ptSize = Math.abs(pt.y);
    int ttype = fontTx.getType();
    if ((ttype & ~AffineTransform.TYPE_UNIFORM_SCALE) != 0 ||
        fontTx.getScaleY() <= 0) {
        /* We need to create an inverse transform that doesn't
         * include the point size (strictly the uniform scale)
         */
        fontTx.scale(1/ptSize, 1/ptSize);
    } else {
        fontTx = null; // no need
    }
    return (int)ptSize;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:NativeStrike.java

示例2: NativeStrike

NativeStrike(NativeFont nativeFont, FontStrikeDesc desc) {
    super(nativeFont, desc);
    this.nativeFont = nativeFont;


    /* If this is a delegate for bitmaps, we expect to have
     * been invoked only for a simple scale. If that's not
     * true, just bail
     */
    if (nativeFont.isBitmapDelegate) {
        int ttype = desc.glyphTx.getType();
        if ((ttype & ~AffineTransform.TYPE_UNIFORM_SCALE) != 0 ||
            desc.glyphTx.getScaleX() <= 0) {
        numGlyphs = 0;
        return;
        }
    }

    int ptSize = getNativePointSize();
    byte [] nameBytes = nativeFont.getPlatformNameBytes(ptSize);
    double scale = Math.abs(desc.devTx.getScaleX());
    pScalerContext = createScalerContext(nameBytes, ptSize, scale);
    if (pScalerContext == 0L) {
        SunFontManager.getInstance().deRegisterBadFont(nativeFont);
        pScalerContext = createNullScalerContext();
        numGlyphs = 0;
        if (FontUtilities.isLogging()) {
            FontUtilities.getLogger()
                              .severe("Could not create native strike " +
                                      new String(nameBytes));
        }
        return;
    }
    numGlyphs = nativeFont.getMapper().getNumGlyphs();
    this.disposer = new NativeStrikeDisposer(nativeFont, desc,
                                             pScalerContext);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:NativeStrike.java

示例3: getModifiedType

public static int getModifiedType(AffineTransform at) {
    int type = at.getType();
    // Some of the vector methods can introduce a tiny uniform scale
    // at some angles...
    if ((type & AffineTransform.TYPE_UNIFORM_SCALE) != 0) {
        maxulps = Math.max(maxulps, ulps(at.getDeterminant(), 1.0));
        if (ulps(at.getDeterminant(), 1.0) <= MAX_ULPS) {
            // Really tiny - we will ignore it
            type &= (~AffineTransform.TYPE_UNIFORM_SCALE);
        }
    }
    return type;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:TestRotateMethods.java


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