本文整理汇总了Java中java.awt.geom.GeneralPath.WIND_EVEN_ODD属性的典型用法代码示例。如果您正苦于以下问题:Java GeneralPath.WIND_EVEN_ODD属性的具体用法?Java GeneralPath.WIND_EVEN_ODD怎么用?Java GeneralPath.WIND_EVEN_ODD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.geom.GeneralPath
的用法示例。
在下文中一共展示了GeneralPath.WIND_EVEN_ODD属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
void draw(Graphics2D g, int cap) {
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
BasicStroke stroke = getStroke(cap);
if (stroke == null)
return;
g.setStroke(stroke);
g.setColor(getColor());
GeneralPath gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
for (ArrayList<Point2D.Float> line : points) {
gp.moveTo(line.get(0).x, line.get(0).y);
for (Point2D.Float p : line) {
if (!p.equals(line.get(0)))
gp.lineTo(p.x, p.y);
else if (p != line.get(0))
gp.closePath();
}
}
g.draw(gp);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
示例2: makePoly
private Shape makePoly(int xPoints[], int yPoints[],
int nPoints, boolean close) {
GeneralPath gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
if (nPoints > 0) {
gp.moveTo(xPoints[0], yPoints[0]);
for (int i = 1; i < nPoints; i++) {
gp.lineTo(xPoints[i], yPoints[i]);
}
if (close) {
gp.closePath();
}
}
return gp;
}
示例3: drawArc
public void drawArc(int from, int to, boolean bold, String txt, Graphics2D g2d, Color c) {
Color oldc = g2d.getColor();
g2d.setColor(c);
arrow = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
double x1, x2, ctrlx, ctrly, y;
if (bold) {
g2d.setStroke(strokeB);
}
if (from > to) {
// arc settings
x2 = to * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP + STATUS_RAD * 2;//+ ELEMS_GAP;
x1 = from * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP;// - ELEMS_GAP;
y = (panelH) / 2.0 + STATUS_RAD;
ctrly = y + STATUS_RAD;
// arrow settings
arrow.moveTo((float) x2, (float) y);
arrow.lineTo((float) x2 + arroww, (float) y);
arrow.lineTo((float) x2, (float) y + arroww);
arrow.closePath();
} else {
// arc settings
x1 = from * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP + STATUS_RAD * 2;//+ ELEMS_GAP;
x2 = to * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP;// - ELEMS_GAP;
y = (panelH - STATUS_RAD * 2) / 2.0;
ctrly = y - STATUS_RAD;
// arrow settings
arrow.moveTo((float) x2, (float) y);
arrow.lineTo((float) x2 - arroww, (float) y);
arrow.lineTo((float) x2, (float) y - arroww);
arrow.closePath();
}
ctrlx = (x1 + x2) / 2;
arc[from][to] = new QuadCurve2D.Double(x1, y, ctrlx, ctrly, x2, y);
g2d.draw(arc[from][to]);
g2d.draw(arrow);
g2d.fill(arrow);
g2d.setColor(oldc);
g2d.setStroke(stroke);
}
示例4: drawArc
public void drawArc(int from, int to, boolean bold, String txt, Graphics2D g2d, Color c) {
Color oldc = g2d.getColor();
g2d.setColor(c);
arrow = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
double x1, x2, ctrlx, ctrly, arrowx, arrowy, y;
if (bold) {
g2d.setStroke(strokeB);
}
if (from > to) {
// arc settings
x2 = to * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP + STATUS_RAD * 2;//+ ELEMS_GAP;
x1 = from * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP;// - ELEMS_GAP;
y = (panelH) / 2.0 + STATUS_RAD;
ctrly = y + STATUS_RAD;
// arrow settings
arrow.moveTo((float) x2, (float) y);
arrow.lineTo((float) x2 + arroww, (float) y);
arrow.lineTo((float) x2, (float) y + arroww);
arrow.closePath();
} else {
// arc settings
x1 = from * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP + STATUS_RAD * 2;//+ ELEMS_GAP;
x2 = to * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP;// - ELEMS_GAP;
y = (panelH - STATUS_RAD * 2) / 2.0;
ctrly = y - STATUS_RAD;
// arrow settings
arrow.moveTo((float) x2, (float) y);
arrow.lineTo((float) x2 - arroww, (float) y);
arrow.lineTo((float) x2, (float) y - arroww);
arrow.closePath();
}
ctrlx = (x1 + x2) / 2;
arc[from][to] = new QuadCurve2D.Double(x1, y, ctrlx, ctrly, x2, y);
g2d.draw(arc[from][to]);
g2d.draw(arrow);
g2d.fill(arrow);
g2d.setColor(oldc);
g2d.setStroke(stroke);
}