Search in sources :

Example 6 with LineAttributes

use of org.eclipse.swt.graphics.LineAttributes in project archi by archimatetool.

the class SWTGraphics method checkPaint.

/**
 * 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.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);
    }
}
Also used : LineAttributes(org.eclipse.swt.graphics.LineAttributes)

Example 7 with LineAttributes

use of org.eclipse.swt.graphics.LineAttributes in project archi by archimatetool.

the class ScaledGraphics method getLineAttributes.

/**
 * @see Graphics#getLineAttributes()
 */
@Override
public LineAttributes getLineAttributes() {
    LineAttributes a = graphics.getLineAttributes();
    a.width = getLocalLineWidth();
    return a;
}
Also used : LineAttributes(org.eclipse.swt.graphics.LineAttributes)

Aggregations

LineAttributes (org.eclipse.swt.graphics.LineAttributes)7 BasicStroke (java.awt.BasicStroke)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1