本文整理汇总了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;
}