当前位置: 首页>>代码示例>>Java>>正文


Java GeneralPath.WIND_EVEN_ODD属性代码示例

本文整理汇总了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);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:20,代码来源:MapBoard.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:PixelToShapeConverter.java

示例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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:44,代码来源:StatiDrawer.java

示例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);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:44,代码来源:StatiDrawer.java


注:本文中的java.awt.geom.GeneralPath.WIND_EVEN_ODD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。