use of java.awt.Stroke in project android_frameworks_base by AOSPA.
the class Paint_Delegate method nGetFillPath.
@LayoutlibDelegate
static /*package*/
boolean nGetFillPath(long native_object, long src, long dst) {
Paint_Delegate paint = sManager.getDelegate(native_object);
if (paint == null) {
return false;
}
Path_Delegate srcPath = Path_Delegate.getDelegate(src);
if (srcPath == null) {
return true;
}
Path_Delegate dstPath = Path_Delegate.getDelegate(dst);
if (dstPath == null) {
return true;
}
Stroke stroke = paint.getJavaStroke();
Shape strokeShape = stroke.createStrokedShape(srcPath.getJavaShape());
dstPath.setJavaShape(strokeShape);
// FIXME figure out the return value?
return true;
}
use of java.awt.Stroke in project Activiti by Activiti.
the class DefaultProcessDiagramCanvas method drawHighLight.
public void drawHighLight(int x, int y, int width, int height) {
Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke();
g.setPaint(HIGHLIGHT_COLOR);
g.setStroke(THICK_TASK_BORDER_STROKE);
RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);
g.draw(rect);
g.setPaint(originalPaint);
g.setStroke(originalStroke);
}
use of java.awt.Stroke in project Activiti by Activiti.
the class DefaultProcessDiagramCanvas method drawTask.
protected void drawTask(String name, GraphicInfo graphicInfo, boolean thickBorder) {
Paint originalPaint = g.getPaint();
int x = (int) graphicInfo.getX();
int y = (int) graphicInfo.getY();
int width = (int) graphicInfo.getWidth();
int height = (int) graphicInfo.getHeight();
// Create a new gradient paint for every task box, gradient depends on x and y and is not relative
g.setPaint(TASK_BOX_COLOR);
int arcR = 6;
if (thickBorder)
arcR = 3;
// shape
RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, arcR, arcR);
g.fill(rect);
g.setPaint(TASK_BORDER_COLOR);
if (thickBorder) {
Stroke originalStroke = g.getStroke();
g.setStroke(THICK_TASK_BORDER_STROKE);
g.draw(rect);
g.setStroke(originalStroke);
} else {
g.draw(rect);
}
g.setPaint(originalPaint);
// text
if (name != null && name.length() > 0) {
int boxWidth = width - (2 * TEXT_PADDING);
int boxHeight = height - 16 - ICON_PADDING - ICON_PADDING - MARKER_WIDTH - 2 - 2;
int boxX = x + width / 2 - boxWidth / 2;
int boxY = y + height / 2 - boxHeight / 2 + ICON_PADDING + ICON_PADDING - 2 - 2;
drawMultilineCentredText(name, boxX, boxY, boxWidth, boxHeight);
}
}
use of java.awt.Stroke in project Activiti by Activiti.
the class DefaultProcessDiagramCanvas method drawCatchingEvent.
public void drawCatchingEvent(GraphicInfo graphicInfo, boolean isInterrupting, BufferedImage image, String eventType, double scaleFactor) {
// event circles
Ellipse2D outerCircle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight());
int innerCircleSize = (int) (4 / scaleFactor);
if (innerCircleSize == 0) {
innerCircleSize = 1;
}
int innerCircleX = (int) graphicInfo.getX() + innerCircleSize;
int innerCircleY = (int) graphicInfo.getY() + innerCircleSize;
int innerCircleWidth = (int) graphicInfo.getWidth() - (2 * innerCircleSize);
int innerCircleHeight = (int) graphicInfo.getHeight() - (2 * innerCircleSize);
Ellipse2D innerCircle = new Ellipse2D.Double(innerCircleX, innerCircleY, innerCircleWidth, innerCircleHeight);
Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke();
g.setPaint(EVENT_COLOR);
g.fill(outerCircle);
g.setPaint(EVENT_BORDER_COLOR);
if (isInterrupting == false)
g.setStroke(NON_INTERRUPTING_EVENT_STROKE);
g.draw(outerCircle);
g.setStroke(originalStroke);
g.setPaint(originalPaint);
g.draw(innerCircle);
if (image != null) {
// calculate coordinates to center image
int imageX = (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 2) - (image.getWidth() / 2 * scaleFactor));
int imageY = (int) (graphicInfo.getY() + (graphicInfo.getHeight() / 2) - (image.getHeight() / 2 * scaleFactor));
if (scaleFactor == 1.0 && "timer".equals(eventType)) {
// move image one pixel to center timer image
imageX++;
imageY++;
}
g.drawImage(image, imageX, imageY, (int) (image.getWidth() / scaleFactor), (int) (image.getHeight() / scaleFactor), null);
}
}
use of java.awt.Stroke in project Activiti by Activiti.
the class DefaultProcessDiagramCanvas method drawNoneEndEvent.
public void drawNoneEndEvent(GraphicInfo graphicInfo, double scaleFactor) {
Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke();
g.setPaint(EVENT_COLOR);
Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight());
g.fill(circle);
g.setPaint(EVENT_BORDER_COLOR);
if (scaleFactor == 1.0) {
g.setStroke(END_EVENT_STROKE);
} else {
g.setStroke(new BasicStroke(2.0f));
}
g.draw(circle);
g.setStroke(originalStroke);
g.setPaint(originalPaint);
}
Aggregations