use of java.awt.Stroke in project vcell by virtualcell.
the class RectangleShape method paintSelf.
@Override
public void paintSelf(Graphics2D g2D, int absPosX, int absPosY) {
// draw rectangle
g2D.setColor(backgroundColor);
if (!bNoFill) {
g2D.fillRect(absPosX, absPosY, getSpaceManager().getSize().width, getSpaceManager().getSize().height);
}
g2D.setColor(forgroundColor);
Stroke oldStroke = g2D.getStroke();
if (isSelected()) {
g2D.setStroke(selectRectangleStroke);
g2D.drawRect(absPosX + 2, absPosY + 2, getSpaceManager().getSize().width - 4, getSpaceManager().getSize().height - 4);
}
g2D.drawRect(absPosX, absPosY, getSpaceManager().getSize().width, getSpaceManager().getSize().height);
if (isSelected()) {
g2D.setStroke(oldStroke);
}
drawLabel(g2D, absPosX, absPosY);
}
use of java.awt.Stroke in project vcell by virtualcell.
the class OverlayImageDisplayJAI method paint.
public void paint(Graphics g) {
super.paint(g);
if (getCrop() != null) {
// Composite origComposite = ((Graphics2D)g).getComposite();
// ((Graphics2D)g).setComposite(AlphaComposite.Xor);
g.setColor(Color.green);
g.drawRect(getCrop().x, getCrop().y, getCrop().width, getCrop().height);
// ((Graphics2D)g).setComposite(origComposite);
} else if (starShape != null) {
Graphics2D tempG = (Graphics2D) g.create();
try {
Stroke bigStroke = new BasicStroke(3.0f);
Stroke smallStroke = new BasicStroke(1.0f);
// tempG.scale(getZoom(), getZoom());
Rectangle rect = starShape.getBounds();
tempG.translate((rect.getX() + rect.getWidth() / 2) * (getZoom() - 1), (rect.getY() + rect.getHeight() / 2) * (getZoom() - 1));
tempG.setColor(Color.black);
tempG.setStroke(bigStroke);
tempG.draw(starShape);
tempG.setColor(Color.white);
tempG.setStroke(smallStroke);
tempG.draw(starShape);
} finally {
tempG.dispose();
}
} else if (brushShape != null) {
g.setColor(Color.green);
((Graphics2D) g).draw(brushShape);
}
}
use of java.awt.Stroke in project vcell by virtualcell.
the class SpeciesSizeShapeIcon method paintIcon.
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (c == null) {
return;
}
Graphics2D g2 = (Graphics2D) g;
Color colorOld = g2.getColor();
Paint paintOld = g2.getPaint();
Stroke strokeOld = g2.getStroke();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
int offset;
if (state == State.normal) {
offset = 0;
} else {
offset = 1;
}
int xx = x + 1 + offset;
int yy = y + 1 + offset;
double h = diameter - 5;
g2.setStroke(new BasicStroke(1.6f));
g2.setPaint(Color.darkGray);
DoubleArrow arrow = new DoubleArrow(xx + 13, yy, h);
g2.draw(arrow);
if (kind == Kind.equal) {
g2.setStroke(new BasicStroke(2.4f));
g2.setPaint(Color.magenta.darker().darker());
Line2D upper = new Line2D.Double(xx, yy + 9, xx + 7, yy + 9);
g2.draw(upper);
Line2D lower = new Line2D.Double(xx, yy + 13, xx + 7, yy + 13);
g2.draw(lower);
} else if (kind == Kind.weight) {
g2.setStroke(new BasicStroke(1.2f));
RoundRectangle2D rr = new RoundRectangle2D.Double(xx, yy + 9, 7, 7, 2, 2);
g2.setPaint(Color.yellow);
g2.fill(rr);
g2.setPaint(Color.gray);
g2.draw(rr);
} else if (kind == Kind.length) {
g2.setStroke(new BasicStroke(1.5f));
g2.setPaint(Color.blue.darker());
Line2D upper = new Line2D.Double(xx - 2, yy + 9, xx + 1, yy + 9);
g2.draw(upper);
Line2D mid = new Line2D.Double(xx - 2, yy + 12, xx + 4, yy + 12);
g2.draw(mid);
Line2D lower = new Line2D.Double(xx - 2, yy + 15, xx + 7, yy + 15);
g2.draw(lower);
}
g2.setStroke(strokeOld);
g2.setColor(colorOld);
g2.setPaint(paintOld);
}
use of java.awt.Stroke in project vcell by virtualcell.
the class StructureToolShapeIcon method paintIcon.
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (c == null) {
return;
}
Graphics2D g2 = (Graphics2D) g;
Color colorOld = g2.getColor();
Paint paintOld = g2.getPaint();
Stroke strokeOld = g2.getStroke();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color c1, c2, c3;
int xx, yy;
g2.setStroke(new BasicStroke(1.8f));
if (state == State.normal) {
c1 = SpeciesPatternLargeShape.componentBad.darker();
c2 = Color.black;
xx = x + 1;
yy = y + 1;
} else {
// button pressed
c1 = SpeciesPatternLargeShape.componentBad;
c2 = Color.red.darker().darker().darker();
// c2 = SpeciesPatternLargeShape.componentBad.darker().darker().darker();
xx = x + 2;
yy = y + 2;
}
// external red circle
double w = diameter - 4;
double h = diameter - 4;
Ellipse2D e1 = new Ellipse2D.Double(xx, yy, w, h);
GradientPaint gp1 = new GradientPaint(25, 25, c1, 35, 32, c2, true);
g2.setPaint(gp1);
g2.draw(e1);
g2.setStroke(new BasicStroke(1.6f));
if (state == State.normal) {
c1 = Color.black;
c2 = SpeciesPatternLargeShape.componentGreen.darker();
xx = x + 5;
yy = y + 5;
} else {
// button pressed
c1 = Color.green.darker().darker().darker();
c2 = SpeciesPatternLargeShape.componentGreen.darker();
xx = x + 6;
yy = y + 6;
}
// inner green circle
w = w / 2;
h = h / 2;
Ellipse2D e2 = new Ellipse2D.Double(xx, yy, w, h);
GradientPaint gp2 = new GradientPaint(25, 25, c1, 28, 28, c2, true);
g2.setPaint(gp2);
g2.draw(e2);
g2.setStroke(strokeOld);
g2.setColor(colorOld);
g2.setPaint(paintOld);
}
use of java.awt.Stroke in project vcell by virtualcell.
the class VisItShapeIcon method paintIcon.
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (c == null) {
return;
}
Graphics2D g2 = (Graphics2D) g;
Color colorOld = g2.getColor();
Paint paintOld = g2.getPaint();
Stroke strokeOld = g2.getStroke();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// (diameter-circleDiameter) / 2
int xx = 1;
int yy = 1;
Color out2, out1, exterior, middle, interior, pole;
if (state == State.enabled) {
out2 = Color.red.darker();
out1 = Color.red;
exterior = Color.orange;
middle = Color.yellow;
interior = Color.green;
pole = Color.cyan.darker();
xx += x;
yy += y;
} else {
out2 = Color.darkGray;
out1 = Color.gray;
exterior = Color.lightGray;
middle = Color.gray;
interior = Color.gray;
pole = Color.darkGray;
xx += x;
yy += y;
}
Ellipse2D e = new Ellipse2D.Double(xx, yy, circleDiameter, circleDiameter);
Point2D center = new Point2D.Float(xx + circleDiameter / 2, yy + circleDiameter / 2);
// *0.7f;
float radius = circleDiameter + 2;
Point2D focus = new Point2D.Float(xx + circleDiameter / 2 + 7, yy + circleDiameter / 2 + 5);
float[] dist = { 0.1f, 0.15f, 0.25f, 0.35f, 0.45f, 0.6f };
Color[] colors = { pole, interior, middle, exterior, out1, out2 };
RadialGradientPaint p = new RadialGradientPaint(center, radius, focus, dist, colors, CycleMethod.NO_CYCLE);
g2.setPaint(p);
g2.fill(e);
g.setColor(Color.gray);
g2.draw(e);
g2.setStroke(strokeOld);
g2.setColor(colorOld);
g2.setPaint(paintOld);
}
Aggregations