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


Java AffineTransform.TYPE_GENERAL_ROTATION属性代码示例

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


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

示例1: needToCopyBgColorImage

/**
 * Return true if drawing <code>img</code> will
 * invoke a Java2D bug (#4258675). The bug in question
 * occurs when a draw image call with a background color
 * parameter tries to render a sheared
 * or rotated image. The portions of the bounding
 * rectangle not covered by the sheared image
 * are incorrectly drawn with the background color.
 */
private boolean needToCopyBgColorImage(Image img) {

    boolean needToCopy;

    AffineTransform transform = getTransform();

    return (transform.getType()
            & (AffineTransform.TYPE_GENERAL_ROTATION
               | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:ProxyGraphics2D.java

示例2: deviceFillRect

@Override
protected void deviceFillRect(int x, int y, int width, int height,
                              Color color) {
    /*
     * Transform to device coordinates
     */
    AffineTransform deviceTransform = getTransform();

    /* check if rotated or sheared */
    int transformType = deviceTransform.getType();
    boolean usePath =  ((transformType &
                           (AffineTransform.TYPE_GENERAL_ROTATION |
                            AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0);
    if (usePath) {
        fill(new Rectangle2D.Float(x, y, width, height));
        return;
    }

    Point2D.Float tlc_pos = new Point2D.Float(x, y);
    deviceTransform.transform(tlc_pos, tlc_pos);

    Point2D.Float brc_pos = new Point2D.Float(x+width, y+height);
    deviceTransform.transform(brc_pos, brc_pos);

    float deviceWidth = (float) (brc_pos.getX() - tlc_pos.getX());
    float deviceHeight = (float)(brc_pos.getY() - tlc_pos.getY());

    WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
    wPrinterJob.fillRect((float)tlc_pos.getX(), (float)tlc_pos.getY(),
                         deviceWidth, deviceHeight, color);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:WPathGraphics.java

示例3: needToCopyBgColorImage

/**
 * Return true if drawing {@code img} will
 * invoke a Java2D bug (#4258675). The bug in question
 * occurs when a draw image call with a background color
 * parameter tries to render a sheared
 * or rotated image. The portions of the bounding
 * rectangle not covered by the sheared image
 * are incorrectly drawn with the background color.
 */
private boolean needToCopyBgColorImage(Image img) {

    boolean needToCopy;

    AffineTransform transform = getTransform();

    return (transform.getType()
            & (AffineTransform.TYPE_GENERAL_ROTATION
               | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ProxyGraphics2D.java

示例4: isTransformQuadrantRotated

public static boolean isTransformQuadrantRotated(AffineTransform tr) {
    return ((tr.getType() & (AffineTransform.TYPE_GENERAL_ROTATION |
             AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:XRUtils.java

示例5: getStrike

private FontStrike getStrike(FontStrikeDesc desc, boolean copy) {
    /* Before looking in the map, see if the descriptor matches the
     * last strike returned from this Font2D. This should often be a win
     * since its common for the same font, in the same size to be
     * used frequently, for example in many parts of a UI.
     *
     * If its not the same then we use the descriptor to locate a
     * Reference to the strike. If it exists and points to a strike,
     * then we update the last strike to refer to that and return it.
     *
     * If the key isn't in the map, or its reference object has been
     * collected, then we create a new strike, put it in the map and
     * set it to be the last strike.
     */
    FontStrike strike = lastFontStrike.get();
    if (strike != null && desc.equals(strike.desc)) {
        //strike.lastlookupTime = System.currentTimeMillis();
        return strike;
    } else {
        Reference<FontStrike> strikeRef = strikeCache.get(desc);
        if (strikeRef != null) {
            strike = strikeRef.get();
            if (strike != null) {
                //strike.lastlookupTime = System.currentTimeMillis();
                lastFontStrike = new SoftReference<>(strike);
                StrikeCache.refStrike(strike);
                return strike;
            }
        }
        /* When we create a new FontStrike instance, we *must*
         * ask the StrikeCache for a reference. We must then ensure
         * this reference remains reachable, by storing it in the
         * Font2D's strikeCache map.
         * So long as the Reference is there (reachable) then if the
         * reference is cleared, it will be enqueued for disposal.
         * If for some reason we explicitly remove this reference, it
         * must only be done when holding a strong reference to the
         * referent (the FontStrike), or if the reference is cleared,
         * then we must explicitly "dispose" of the native resources.
         * The only place this currently happens is in this same method,
         * where we find a cleared reference and need to overwrite it
         * here with a new reference.
         * Clearing the whilst holding a strong reference, should only
         * be done if the
         */
        if (copy) {
            desc = new FontStrikeDesc(desc);
        }
        strike = createStrike(desc);
        //StrikeCache.addStrike();
        /* If we are creating many strikes on this font which
         * involve non-quadrant rotations, or more general
         * transforms which include shears, then force the use
         * of weak references rather than soft references.
         * This means that it won't live much beyond the next GC,
         * which is what we want for what is likely a transient strike.
         */
        int txType = desc.glyphTx.getType();
        if (txType == AffineTransform.TYPE_GENERAL_TRANSFORM ||
            (txType & AffineTransform.TYPE_GENERAL_ROTATION) != 0 &&
            strikeCache.size() > 10) {
            strikeRef = StrikeCache.getStrikeRef(strike, true);
        } else {
            strikeRef = StrikeCache.getStrikeRef(strike);
        }
        strikeCache.put(desc, strikeRef);
        //strike.lastlookupTime = System.currentTimeMillis();
        lastFontStrike = new SoftReference<>(strike);
        StrikeCache.refStrike(strike);
        return strike;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:72,代码来源:Font2D.java


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