use of java.awt.BasicStroke in project processdash by dtuma.
the class PSPTaskIcon method paintIcon.
@Override
protected void paintIcon(Graphics2D g2, Shape clip, float scale) {
// fill the shape
g2.setColor(fill);
g2.fill(shape);
// draw shadows (bottom and bottom-right edges)
g2.setStroke(BEVEL);
g2.setColor(shadow);
clip(g2, clip, edges[1]);
g2.draw(shape);
clip(g2, clip, edges[2]);
g2.draw(shape);
// draw highlights (top-right and bottom-left edges)
g2.setColor(highlight);
clip(g2, clip, edges[0]);
g2.draw(shape);
clip(g2, clip, edges[3]);
g2.draw(shape);
// draw glare (top-left edge)
g2.setColor(glare);
clip(g2, clip, edges[4]);
g2.draw(shape);
// draw outline
g2.setStroke(new BasicStroke(1f / scale));
g2.setColor(edge);
g2.setClip(clip);
g2.draw(shape);
}
use of java.awt.BasicStroke in project processdash by dtuma.
the class Rectangle3DIcon method paintIcon.
@Override
protected void paintIcon(Graphics2D g2, Shape clip, float scale) {
// fill the shape
g2.setColor(fill);
g2.fill(shape);
// draw highlights
g2.setStroke(BEVEL);
g2.setColor(highlight);
clip(g2, clip, topLeft);
g2.draw(shape);
// draw shadows
g2.setColor(shadow);
clip(g2, clip, bottomRight);
g2.draw(shape);
// draw edge
g2.setStroke(new BasicStroke(Math.min(scale, 1) / scale));
g2.setColor(edge);
g2.setClip(clip);
g2.draw(shape);
}
use of java.awt.BasicStroke in project processdash by dtuma.
the class TaskIcon method paintIcon.
@Override
protected void paintIcon(Graphics2D g2, Shape clip, float scale) {
// fill the shape
g2.setColor(fill);
g2.fill(shape);
// draw highlights
g2.setStroke(BEVEL);
clip(g2, clip, topLeft);
g2.setColor(highlight);
g2.draw(shape);
// draw shadows
clip(g2, clip, bottomRight);
g2.setColor(shadow);
g2.draw(shape);
// draw edge
g2.setStroke(new BasicStroke(Math.min(scale, 1) / scale));
g2.setClip(clip);
g2.setColor(edge);
g2.draw(shape);
}
use of java.awt.BasicStroke in project processdash by dtuma.
the class DefectIcon method paintIcon.
@Override
protected void paintIcon(Graphics2D g2, int width, int height, float scale) {
// calculate geometry and shapes of the icon
int w = width;
int h = height;
int pad = height / 5;
int pad2 = 2 * pad;
int yMid = h / 2;
Shape torso = new Ellipse2D.Double(pad + 3, pad, w - pad - 4, h - pad2 - 1);
Shape head = new Ellipse2D.Double(pad - 1, yMid - pad, pad2, pad2);
Area outsideTorso = new Area(new Rectangle2D.Double(0, 0, w, h));
outsideTorso.subtract(new Area(torso));
Area outsideHead = new Area(new Rectangle2D.Double(0, 0, w, h));
outsideHead.subtract(new Area(head));
Area body = new Area(torso);
body.add(new Area(head));
Area outsideBody = new Area(outsideTorso);
outsideBody.subtract(new Area(head));
g2.setStroke(new BasicStroke(scale));
g2.setClip(outsideBody);
g2.setColor(outline);
// antennae
g2.drawArc(-1 - pad, yMid - pad - 1, pad2 + 2, pad2 + 2, -90, 180);
// front legs
g2.drawArc(pad2 + 1, 0, h - 1, h - 1, 90, 180);
// middle legs
g2.drawArc(w / 2 + 1, 0, h - 1, h - 1, 90, 180);
// back legs
g2.drawArc(w - h / 2 + pad, 2, h - 6, h - 5, 90, 180);
if (fill != null) {
g2.setClip(null);
g2.setColor(fill);
g2.fill(body.createTransformedArea(AffineTransform.getTranslateInstance(0.5, 0.5)));
// zigzags
g2.setClip(torso);
g2.setColor(contrast);
g2.setStroke(new BasicStroke(pad * 0.7f));
for (int num = 0, i = w - pad2; num++ < 3; i -= pad2) {
Path2D.Double stripe = new Path2D.Double();
int hhh = (h - pad2) / 4;
stripe.moveTo(i + hhh, yMid - 2 * hhh);
stripe.lineTo(i, yMid - hhh);
stripe.lineTo(i + hhh, yMid);
stripe.lineTo(i, yMid + hhh);
stripe.lineTo(i + hhh, yMid + 2 * hhh);
g2.draw(stripe);
}
}
g2.setColor(outline);
g2.setStroke(new BasicStroke(1));
g2.setClip(outsideHead);
g2.draw(torso);
g2.setClip(outsideTorso);
g2.draw(head);
}
use of java.awt.BasicStroke in project processdash by dtuma.
the class UndoIcon method paintIcon.
@Override
protected void paintIcon(Graphics2D g2, Shape clip, float scale) {
g2.setStroke(new BasicStroke(0.7f / scale));
// draw the back portion
g2.setColor(shadow);
g2.fill(back);
g2.setColor(edge);
g2.draw(back);
// draw the front portion
g2.setColor(fill);
g2.fill(front);
g2.setColor(edge);
g2.draw(front);
}
Aggregations