本文整理匯總了Java中java.awt.geom.PathIterator.WIND_EVEN_ODD屬性的典型用法代碼示例。如果您正苦於以下問題:Java PathIterator.WIND_EVEN_ODD屬性的具體用法?Java PathIterator.WIND_EVEN_ODD怎麽用?Java PathIterator.WIND_EVEN_ODD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.geom.PathIterator
的用法示例。
在下文中一共展示了PathIterator.WIND_EVEN_ODD屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAATileGenerator
public AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int bbox[])
{
// REMIND: Deal with large coordinates!
double ldx1, ldy1, ldx2, ldy2;
boolean innerpgram = (lw1 > 0 && lw2 > 0);
if (innerpgram) {
ldx1 = dx1 * lw1;
ldy1 = dy1 * lw1;
ldx2 = dx2 * lw2;
ldy2 = dy2 * lw2;
x -= (ldx1 + ldx2) / 2.0;
y -= (ldy1 + ldy2) / 2.0;
dx1 += ldx1;
dy1 += ldy1;
dx2 += ldx2;
dy2 += ldy2;
if (lw1 > 1 && lw2 > 1) {
// Inner parallelogram was entirely consumed by stroke...
innerpgram = false;
}
} else {
ldx1 = ldy1 = ldx2 = ldy2 = 0;
}
Renderer r = new Renderer(3, 3,
clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight(),
PathIterator.WIND_EVEN_ODD);
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
if (innerpgram) {
x += ldx1 + ldx2;
y += ldy1 + ldy2;
dx1 -= 2.0 * ldx1;
dy1 -= 2.0 * ldy1;
dx2 -= 2.0 * ldx2;
dy2 -= 2.0 * ldy2;
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
}
r.pathDone();
r.endRendering();
PiscesTileGenerator ptg = new PiscesTileGenerator(r, r.MAX_AA_ALPHA);
ptg.getBbox(bbox);
return ptg;
}
示例2: convertToPSPath
/**
* Given a Java2D <code>PathIterator</code> instance,
* this method translates that into a PostScript path..
*/
void convertToPSPath(PathIterator pathIter) {
float[] segment = new float[6];
int segmentType;
/* Map the PathIterator's fill rule into the PostScript
* fill rule.
*/
int fillRule;
if (pathIter.getWindingRule() == PathIterator.WIND_EVEN_ODD) {
fillRule = FILL_EVEN_ODD;
} else {
fillRule = FILL_WINDING;
}
beginPath();
setFillMode(fillRule);
while (pathIter.isDone() == false) {
segmentType = pathIter.currentSegment(segment);
switch (segmentType) {
case PathIterator.SEG_MOVETO:
moveTo(segment[0], segment[1]);
break;
case PathIterator.SEG_LINETO:
lineTo(segment[0], segment[1]);
break;
/* Convert the quad path to a bezier.
*/
case PathIterator.SEG_QUADTO:
float lastX = getPenX();
float lastY = getPenY();
float c1x = lastX + (segment[0] - lastX) * 2 / 3;
float c1y = lastY + (segment[1] - lastY) * 2 / 3;
float c2x = segment[2] - (segment[2] - segment[0]) * 2/ 3;
float c2y = segment[3] - (segment[3] - segment[1]) * 2/ 3;
bezierTo(c1x, c1y,
c2x, c2y,
segment[2], segment[3]);
break;
case PathIterator.SEG_CUBICTO:
bezierTo(segment[0], segment[1],
segment[2], segment[3],
segment[4], segment[5]);
break;
case PathIterator.SEG_CLOSE:
closeSubpath();
break;
}
pathIter.next();
}
}
示例3: convertToWPath
/**
* Given a Java2D <code>PathIterator</code> instance,
* this method translates that into a Window's path
* in the printer device context.
*/
private void convertToWPath(PathIterator pathIter) {
float[] segment = new float[6];
int segmentType;
WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
/* Map the PathIterator's fill rule into the Window's
* polygon fill rule.
*/
int polyFillRule;
if (pathIter.getWindingRule() == PathIterator.WIND_EVEN_ODD) {
polyFillRule = WPrinterJob.POLYFILL_ALTERNATE;
} else {
polyFillRule = WPrinterJob.POLYFILL_WINDING;
}
wPrinterJob.setPolyFillMode(polyFillRule);
wPrinterJob.beginPath();
while (pathIter.isDone() == false) {
segmentType = pathIter.currentSegment(segment);
switch (segmentType) {
case PathIterator.SEG_MOVETO:
wPrinterJob.moveTo(segment[0], segment[1]);
break;
case PathIterator.SEG_LINETO:
wPrinterJob.lineTo(segment[0], segment[1]);
break;
/* Convert the quad path to a bezier.
*/
case PathIterator.SEG_QUADTO:
int lastX = wPrinterJob.getPenX();
int lastY = wPrinterJob.getPenY();
float c1x = lastX + (segment[0] - lastX) * 2 / 3;
float c1y = lastY + (segment[1] - lastY) * 2 / 3;
float c2x = segment[2] - (segment[2] - segment[0]) * 2/ 3;
float c2y = segment[3] - (segment[3] - segment[1]) * 2/ 3;
wPrinterJob.polyBezierTo(c1x, c1y,
c2x, c2y,
segment[2], segment[3]);
break;
case PathIterator.SEG_CUBICTO:
wPrinterJob.polyBezierTo(segment[0], segment[1],
segment[2], segment[3],
segment[4], segment[5]);
break;
case PathIterator.SEG_CLOSE:
wPrinterJob.closeFigure();
break;
}
pathIter.next();
}
wPrinterJob.endPath();
}
示例4: convertToPSPath
/**
* Given a Java2D {@code PathIterator} instance,
* this method translates that into a PostScript path..
*/
void convertToPSPath(PathIterator pathIter) {
float[] segment = new float[6];
int segmentType;
/* Map the PathIterator's fill rule into the PostScript
* fill rule.
*/
int fillRule;
if (pathIter.getWindingRule() == PathIterator.WIND_EVEN_ODD) {
fillRule = FILL_EVEN_ODD;
} else {
fillRule = FILL_WINDING;
}
beginPath();
setFillMode(fillRule);
while (pathIter.isDone() == false) {
segmentType = pathIter.currentSegment(segment);
switch (segmentType) {
case PathIterator.SEG_MOVETO:
moveTo(segment[0], segment[1]);
break;
case PathIterator.SEG_LINETO:
lineTo(segment[0], segment[1]);
break;
/* Convert the quad path to a bezier.
*/
case PathIterator.SEG_QUADTO:
float lastX = getPenX();
float lastY = getPenY();
float c1x = lastX + (segment[0] - lastX) * 2 / 3;
float c1y = lastY + (segment[1] - lastY) * 2 / 3;
float c2x = segment[2] - (segment[2] - segment[0]) * 2/ 3;
float c2y = segment[3] - (segment[3] - segment[1]) * 2/ 3;
bezierTo(c1x, c1y,
c2x, c2y,
segment[2], segment[3]);
break;
case PathIterator.SEG_CUBICTO:
bezierTo(segment[0], segment[1],
segment[2], segment[3],
segment[4], segment[5]);
break;
case PathIterator.SEG_CLOSE:
closeSubpath();
break;
}
pathIter.next();
}
}
示例5: convertToWPath
/**
* Given a Java2D {@code PathIterator} instance,
* this method translates that into a Window's path
* in the printer device context.
*/
private void convertToWPath(PathIterator pathIter) {
float[] segment = new float[6];
int segmentType;
WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
/* Map the PathIterator's fill rule into the Window's
* polygon fill rule.
*/
int polyFillRule;
if (pathIter.getWindingRule() == PathIterator.WIND_EVEN_ODD) {
polyFillRule = WPrinterJob.POLYFILL_ALTERNATE;
} else {
polyFillRule = WPrinterJob.POLYFILL_WINDING;
}
wPrinterJob.setPolyFillMode(polyFillRule);
wPrinterJob.beginPath();
while (pathIter.isDone() == false) {
segmentType = pathIter.currentSegment(segment);
switch (segmentType) {
case PathIterator.SEG_MOVETO:
wPrinterJob.moveTo(segment[0], segment[1]);
break;
case PathIterator.SEG_LINETO:
wPrinterJob.lineTo(segment[0], segment[1]);
break;
/* Convert the quad path to a bezier.
*/
case PathIterator.SEG_QUADTO:
int lastX = wPrinterJob.getPenX();
int lastY = wPrinterJob.getPenY();
float c1x = lastX + (segment[0] - lastX) * 2 / 3;
float c1y = lastY + (segment[1] - lastY) * 2 / 3;
float c2x = segment[2] - (segment[2] - segment[0]) * 2/ 3;
float c2y = segment[3] - (segment[3] - segment[1]) * 2/ 3;
wPrinterJob.polyBezierTo(c1x, c1y,
c2x, c2y,
segment[2], segment[3]);
break;
case PathIterator.SEG_CUBICTO:
wPrinterJob.polyBezierTo(segment[0], segment[1],
segment[2], segment[3],
segment[4], segment[5]);
break;
case PathIterator.SEG_CLOSE:
wPrinterJob.closeFigure();
break;
}
pathIter.next();
}
wPrinterJob.endPath();
}