SWTGraphics.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:gef-gwt 作者:
/**
 * If the line width, line style, foreground or background colors have
 * changed, these changes will be pushed to the GC. Also calls
 * {@link #checkGC()}.
 */
protected final void checkPaint() {
    checkGC();

    if (currentState.fgColor != null) {
        if (!currentState.fgColor.equals(appliedState.fgColor)
                && currentState.fgPattern == null) {
            gc.setForeground(appliedState.fgColor = currentState.fgColor);
        }
    }

    LineAttributes lineAttributes = currentState.lineAttributes;
    if (!appliedState.lineAttributes.equals(lineAttributes)) {
        if (getAdvanced()) {
            gc.setLineAttributes(lineAttributes);
        } else {
            gc.setLineWidth((int) lineAttributes.width);
            gc.setLineCap(lineAttributes.cap);
            gc.setLineJoin(lineAttributes.join);
            gc.setLineStyle(lineAttributes.style);
            if (lineAttributes.dash != null) {
                gc.setLineDash(convertFloatArrayToInt(lineAttributes.dash));
            }
        }
        appliedState.lineAttributes = clone(lineAttributes);
    }

    if (!currentState.bgColor.equals(appliedState.bgColor)
            && currentState.bgPattern == null) {
        gc.setBackground(appliedState.bgColor = currentState.bgColor);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号