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);
}
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;
}
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);
}
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;
}
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);
}
}
Aggregations