當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。