Search in sources :

Example 1 with LineAttributes

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

the class GraphicsToGraphics2DAdaptor method initSVGGraphics.

/**
 * Create the SVG graphics object and initializes it with the current line
 * stlye and width
 */
private void initSVGGraphics(Graphics2D graphics) {
    this.graphics2D = graphics;
    relativeClipRegion = new Rectangle(viewBox.x, viewBox.y, viewBox.width, viewBox.height);
    // Initialize the line style and width
    stroke = new BasicStroke(swtGraphics.getLineWidth(), BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND, 0, null, 0);
    LineAttributes lineAttributes = new LineAttributes(1);
    swtGraphics.getLineAttributes(lineAttributes);
    setLineAttributes(lineAttributes);
    setFillRule(swtGraphics.getFillRule());
    setAdvanced(swtGraphics.getAdvanced());
    getGraphics2D().setStroke(stroke);
}
Also used : BasicStroke(java.awt.BasicStroke) Rectangle(org.eclipse.draw2d.geometry.Rectangle) LineAttributes(org.eclipse.swt.graphics.LineAttributes)

Example 2 with LineAttributes

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

the class GraphicsToGraphics2DAdaptor method getLineAttributes.

@Override
public LineAttributes getLineAttributes() {
    LineAttributes la = new LineAttributes(1);
    swtGraphics.getLineAttributes(la);
    return la;
}
Also used : LineAttributes(org.eclipse.swt.graphics.LineAttributes)

Example 3 with LineAttributes

use of org.eclipse.swt.graphics.LineAttributes in project dbeaver by dbeaver.

the class GraphicsToGraphics2DAdaptor method initSVGGraphics.

/**
 * Create the SVG graphics object and initializes it with the current line style and width
 */
private void initSVGGraphics(Graphics2D graphics) {
    this.graphics2D = graphics;
    relativeClipRegion = NOCLIPPING;
    // Initialize the line style and width
    stroke = new BasicStroke(swtGraphics.getLineWidth(), BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND, 0, null, 0);
    LineAttributes lineAttributes = new LineAttributes(1);
    swtGraphics.getLineAttributes(lineAttributes);
    setLineAttributes(lineAttributes);
    setFillRule(swtGraphics.getFillRule());
    setAdvanced(swtGraphics.getAdvanced());
    getGraphics2D().setStroke(stroke);
}
Also used : BasicStroke(java.awt.BasicStroke) LineAttributes(org.eclipse.swt.graphics.LineAttributes)

Example 4 with LineAttributes

use of org.eclipse.swt.graphics.LineAttributes in project dbeaver by dbeaver.

the class GraphicsToGraphics2DAdaptor method getLineAttributes.

@Override
public LineAttributes getLineAttributes() {
    LineAttributes la = new LineAttributes(1);
    swtGraphics.getLineAttributes(la);
    return la;
}
Also used : LineAttributes(org.eclipse.swt.graphics.LineAttributes)

Example 5 with LineAttributes

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

the class PrinterGraphics method setLineAttributes.

/**
 * Overridden to translate dashes to printer specific values.
 *
 * @see org.eclipse.draw2d.ScaledGraphics#setLineAttributes(org.eclipse.swt.graphics.LineAttributes)
 */
@Override
public void setLineAttributes(LineAttributes attributes) {
    if (attributes.style == SWT.LINE_CUSTOM && attributes.dash != null && attributes.dash.length > 0) {
        float[] newDashes = new float[attributes.dash.length];
        float printerDot = (float) (printer.getDPI().y / Display.getCurrent().getDPI().y + 0.0000001);
        for (int i = 0; i < attributes.dash.length; i++) {
            newDashes[i] = attributes.dash[i] * printerDot;
        }
        // make a copy of attributes, we dont's want it changed on figure
        // (or display will be affected)
        super.setLineAttributes(new LineAttributes(attributes.width, attributes.cap, attributes.join, attributes.style, newDashes, attributes.dashOffset * printerDot, attributes.miterLimit));
    } else {
        super.setLineAttributes(attributes);
    }
}
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