use of org.eclipse.swt.graphics.Path in project archi by archimatetool.
the class DriverFigure method drawIcon.
/**
* Draw the icon
*/
private void drawIcon(Graphics graphics) {
if (!isIconVisible()) {
return;
}
graphics.pushState();
graphics.setLineWidth(1);
graphics.setForegroundColor(isEnabled() ? ColorConstants.black : ColorConstants.gray);
graphics.setBackgroundColor(isEnabled() ? ColorConstants.black : ColorConstants.gray);
Point pt = getIconOrigin();
Path path = new Path(null);
graphics.setLineWidthFloat(1.2f);
path.addArc(pt.x, pt.y, 13, 13, 0, 360);
path.addArc(pt.x + 5f, pt.y + 5f, 3, 3, 0, 360);
path.addArc(pt.x + 6f, pt.y + 6f, 1f, 1f, 0, 360);
graphics.drawPath(path);
path.dispose();
graphics.setLineWidth(1);
path = new Path(null);
path.moveTo(pt.x - 2, pt.y + 6.5f);
path.lineTo(pt.x + 15, pt.y + 6.5f);
path.moveTo(pt.x + 6.5f, pt.y - 2);
path.lineTo(pt.x + 6.5f, pt.y + 15);
path.moveTo(pt.x + 0.5f, pt.y + 0.5f);
path.lineTo(pt.x + 12.5f, pt.y + 12.5f);
path.moveTo(pt.x + 0.5f, pt.y + 12.5f);
path.lineTo(pt.x + 12.5f, pt.y + 0.5f);
graphics.drawPath(path);
path.dispose();
graphics.popState();
}
use of org.eclipse.swt.graphics.Path in project archi by archimatetool.
the class EventFigure method drawIcon.
/**
* Draw the icon
*/
protected void drawIcon(Graphics graphics) {
if (!isIconVisible()) {
return;
}
graphics.pushState();
graphics.setLineWidth(1);
graphics.setForegroundColor(isEnabled() ? ColorConstants.black : ColorConstants.gray);
Point pt = getIconOrigin();
Path path = new Path(null);
// arc
path.moveTo(pt.x, pt.y);
path.addArc(pt.x - 4, pt.y, 8, 9, 270, 180);
graphics.drawPath(path);
path.dispose();
path = new Path(null);
path.moveTo(pt.x, pt.y);
path.addArc(pt.x + 8, pt.y, 8, 9, 270, 180);
// lines
path.moveTo(pt.x, pt.y);
path.lineTo(pt.x + 12, pt.y);
path.moveTo(pt.x, pt.y + 9);
path.lineTo(pt.x + 12, pt.y + 9);
graphics.drawPath(path);
path.dispose();
graphics.popState();
}
use of org.eclipse.swt.graphics.Path in project archi by archimatetool.
the class FunctionFigure method getFigurePath.
private Path getFigurePath(Rectangle rect) {
Path path = new Path(null);
float y1 = rect.y + (rect.height / OFFSET);
float y2 = rect.y + rect.height - (rect.height / OFFSET);
path.moveTo(rect.x, rect.y + rect.height);
path.lineTo(rect.x, y1);
path.lineTo(rect.x + (rect.width / 2), rect.y);
path.lineTo(rect.x + rect.width, y1);
path.lineTo(rect.x + rect.width, rect.y + rect.height);
path.lineTo(rect.x + (rect.width / 2), y2);
path.close();
return path;
}
use of org.eclipse.swt.graphics.Path in project archi by archimatetool.
the class GoalFigure method drawIcon.
/**
* Draw the icon
*/
private void drawIcon(Graphics graphics) {
if (!isIconVisible()) {
return;
}
graphics.pushState();
graphics.setLineWidth(1);
graphics.setForegroundColor(isEnabled() ? ColorConstants.black : ColorConstants.gray);
graphics.setBackgroundColor(isEnabled() ? ColorConstants.black : ColorConstants.gray);
Point pt = getIconOrigin();
Path path = new Path(null);
graphics.setLineWidthFloat(1.2f);
path.addArc(pt.x, pt.y, 13, 13, 0, 360);
path.addArc(pt.x + 2.5f, pt.y + 2.5f, 8, 8, 0, 360);
path.addArc(pt.x + 5f, pt.y + 5f, 3, 3, 0, 360);
path.addArc(pt.x + 6f, pt.y + 6f, 1f, 1f, 0, 360);
graphics.drawPath(path);
path.dispose();
graphics.popState();
}
use of org.eclipse.swt.graphics.Path in project archi by archimatetool.
the class DeliverableFigure method drawFigure.
@Override
protected void drawFigure(Graphics graphics) {
graphics.pushState();
Rectangle bounds = getBounds().getCopy();
bounds.width--;
bounds.height--;
// Set line width here so that the whole figure is constrained, otherwise SVG graphics will have overspill
int lineWidth = 1;
setLineWidth(graphics, lineWidth, bounds);
int offset = 11;
int curve_y = bounds.y + bounds.height - offset;
graphics.setAlpha(getAlpha());
if (!isEnabled()) {
setDisabledState(graphics);
}
// Main Fill
Path path = new Path(null);
path.moveTo(bounds.x, bounds.y);
path.lineTo(bounds.x, curve_y - 1);
path.quadTo(bounds.x + (bounds.width / 4), bounds.y + bounds.height + offset, bounds.x + bounds.width / 2 + 1, curve_y);
path.quadTo(bounds.x + bounds.width - (bounds.width / 4), curve_y - offset - 1, bounds.x + bounds.width, curve_y);
path.lineTo(bounds.x + bounds.width, bounds.y);
graphics.setBackgroundColor(getFillColor());
Pattern gradient = applyGradientPattern(graphics, bounds);
graphics.fillPath(path);
disposeGradientPattern(graphics, gradient);
// Outline
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
float lineOffset = (float) lineWidth / 2;
path.lineTo(bounds.x - lineOffset, bounds.y);
graphics.drawPath(path);
path.dispose();
// Icon
// drawIconImage(graphics, bounds);
drawIconImage(graphics, bounds, 0, 0, -14, 0);
graphics.popState();
}
Aggregations