本文整理匯總了Java中java.awt.geom.GeneralPath.WIND_NON_ZERO屬性的典型用法代碼示例。如果您正苦於以下問題:Java GeneralPath.WIND_NON_ZERO屬性的具體用法?Java GeneralPath.WIND_NON_ZERO怎麽用?Java GeneralPath.WIND_NON_ZERO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.geom.GeneralPath
的用法示例。
在下文中一共展示了GeneralPath.WIND_NON_ZERO屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getStar
/**
* Return the basic five-point star.
*
* @return the basic star shape
*/
private static GeneralPath getStar() {
GeneralPath star = new GeneralPath(GeneralPath.WIND_NON_ZERO);
double angle = 2 * Math.PI / 5;
double radius = STAR_SIZE / 2;
double x = 0;
double y = -radius;
star.moveTo(x, y);
int[] vertex = { 2, 4, 1, 3 };
for (int i : vertex) {
double phi = i * angle;
x = radius * Math.sin(phi);
y = -radius * Math.cos(phi);
star.lineTo(x, y);
}
star.closePath();
return star;
}
示例2: getOutline
public Shape getOutline(AffineTransform tx) {
GeneralPath dstShape = new GeneralPath(GeneralPath.WIND_NON_ZERO);
for (int i=0, n = 0; i < fComponents.length; i++, n += 2) {
TextLineComponent tlc = fComponents[getComponentLogicalIndex(i)];
dstShape.append(tlc.getOutline(locs[n], locs[n+1]), false);
}
if (tx != null) {
dstShape.transform(tx);
}
return dstShape;
}
示例3: getGlyphsOutline
/**
* Used by getOutline, getGlyphsOutline
*/
private Shape getGlyphsOutline(int start, int count, float x, float y) {
setFRCTX();
initPositions();
GeneralPath result = new GeneralPath(GeneralPath.WIND_NON_ZERO);
for (int i = start, e = start + count, n = start * 2; i < e; ++i, n += 2) {
float px = x + positions[n];
float py = y + positions[n+1];
getGlyphStrike(i).appendGlyphOutline(glyphs[i], result, px, py);
}
return result;
}
示例4: createShape2
protected Shape createShape2() {
int n = view.getPointCount();
if (n > 1) {
JmtEdgeView tmp = (JmtEdgeView) view;
JmtEdge cell = (JmtEdge) tmp.getCell();
Point2D[] p = new Point2D[n];
for (int i = 0; i < n; i++) {
Point2D pt = tmp.getPoint(i);
if (pt == null) {
return null; // exit
}
int x = (int) pt.getX();
int y = (int) pt.getY();
p[i] = new Point2D.Double(x, y);
}
if (view.sharedPath == null) {
view.sharedPath = new GeneralPath(GeneralPath.WIND_NON_ZERO, n);
} else {
view.sharedPath.reset();
}
view.beginShape = view.lineShape = view.endShape = null;
if (endDeco != GraphConstants.ARROW_NONE) {
JmtCell targetOfEdge1 = (JmtCell) ((DefaultPort) cell.getTarget()).getParent();
if (!targetOfEdge1.isLeftInputCell()) {
view.endShape = createLineEnd(endSize, endDeco, new Point2D.Double(p[n - 1].getX() + 10, p[n - 1].getY()), p[n - 1]);
} else {
view.endShape = createLineEnd(endSize, endDeco, new Point2D.Double(p[n - 1].getX() - 10, p[n - 1].getY()), p[n - 1]);
}
}
view.sharedPath.moveTo((float) p[0].getX(), (float) p[0].getY());
for (int i = 0; i < n - 1; i++) {
view.sharedPath.lineTo((float) p[i].getX(), (float) p[i].getY());
view.sharedPath.moveTo((float) p[i].getX(), (float) p[i].getY());
}
view.sharedPath.lineTo((float) p[n - 1].getX(), (float) p[n - 1].getY());
view.sharedPath.moveTo((float) p[n - 1].getX(), (float) p[n - 1].getY());
view.lineShape = (GeneralPath) view.sharedPath.clone();
if (view.endShape != null) {
view.sharedPath.append(view.endShape, true);
}
if (view.beginShape != null) {
view.sharedPath.append(view.beginShape, true);
}
}
return view.sharedPath;
}
示例5: createShape2
protected Shape createShape2() {
ArrayList tmp1 = new ArrayList();
boolean passato = false;
int n = view.getPointCount();
if (n > 1) {
JmtEdgeView tmp = (JmtEdgeView) view;
JmtEdge cell = (JmtEdge) tmp.getCell();
Point2D[] p = null;
p = new Point2D[n];
for (int i = 0; i < n; i++) {
Point2D pt = tmp.getPoint(i);
if (pt == null) {
return null; // exit
}
int x = (int) pt.getX();
int y = (int) pt.getY();
p[i] = new Point2D.Double(x, y);
}
if (view.sharedPath == null) {
view.sharedPath = new GeneralPath(GeneralPath.WIND_NON_ZERO, n);
} else {
view.sharedPath.reset();
}
view.beginShape = view.lineShape = view.endShape = null;
if (endDeco != GraphConstants.ARROW_NONE) {
JmtCell targetOfEdge1 = (JmtCell) ((DefaultPort) cell.getTarget()).getParent();
if (!((targetOfEdge1).isLeftInputCell())) {
view.endShape = createLineEnd(endSize, endDeco, new Point2D.Double(p[n - 1].getX() + 10, p[n - 1].getY()), p[n - 1]);
} else {
view.endShape = createLineEnd(endSize, endDeco, new Point2D.Double(p[n - 1].getX() - 10, p[n - 1].getY()), p[n - 1]);
}
}
view.sharedPath.moveTo((float) p[0].getX(), (float) p[0].getY());
for (int i = 0; i < n - 1; i++) {
view.sharedPath.lineTo((float) p[i].getX(), (float) p[i].getY());
view.sharedPath.moveTo((float) p[i].getX(), (float) p[i].getY());
}
view.sharedPath.lineTo((float) p[n - 1].getX(), (float) p[n - 1].getY());
view.sharedPath.moveTo((float) p[n - 1].getX(), (float) p[n - 1].getY());
view.lineShape = (GeneralPath) view.sharedPath.clone();
if (view.endShape != null) {
view.sharedPath.append(view.endShape, true);
}
if (view.beginShape != null) {
view.sharedPath.append(view.beginShape, true);
}
}
return view.sharedPath;
}