本文整理汇总了Java中sun.awt.geom.Curve.insertCubic方法的典型用法代码示例。如果您正苦于以下问题:Java Curve.insertCubic方法的具体用法?Java Curve.insertCubic怎么用?Java Curve.insertCubic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.awt.geom.Curve
的用法示例。
在下文中一共展示了Curve.insertCubic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pathToCurves
import sun.awt.geom.Curve; //导入方法依赖的package包/类
private static Vector pathToCurves(PathIterator pi) {
Vector curves = new Vector();
int windingRule = pi.getWindingRule();
// coords array is big enough for holding:
// coordinates returned from currentSegment (6)
// OR
// two subdivided quadratic curves (2+4+4=10)
// AND
// 0-1 horizontal splitting parameters
// OR
// 2 parametric equation derivative coefficients
// OR
// three subdivided cubic curves (2+6+6+6=20)
// AND
// 0-2 horizontal splitting parameters
// OR
// 3 parametric equation derivative coefficients
double coords[] = new double[23];
double movx = 0, movy = 0;
double curx = 0, cury = 0;
double newx, newy;
while (!pi.isDone()) {
switch (pi.currentSegment(coords)) {
case PathIterator.SEG_MOVETO:
Curve.insertLine(curves, curx, cury, movx, movy);
curx = movx = coords[0];
cury = movy = coords[1];
Curve.insertMove(curves, movx, movy);
break;
case PathIterator.SEG_LINETO:
newx = coords[0];
newy = coords[1];
Curve.insertLine(curves, curx, cury, newx, newy);
curx = newx;
cury = newy;
break;
case PathIterator.SEG_QUADTO:
newx = coords[2];
newy = coords[3];
Curve.insertQuad(curves, curx, cury, coords);
curx = newx;
cury = newy;
break;
case PathIterator.SEG_CUBICTO:
newx = coords[4];
newy = coords[5];
Curve.insertCubic(curves, curx, cury, coords);
curx = newx;
cury = newy;
break;
case PathIterator.SEG_CLOSE:
Curve.insertLine(curves, curx, cury, movx, movy);
curx = movx;
cury = movy;
break;
}
pi.next();
}
Curve.insertLine(curves, curx, cury, movx, movy);
AreaOp operator;
if (windingRule == PathIterator.WIND_EVEN_ODD) {
operator = new AreaOp.EOWindOp();
} else {
operator = new AreaOp.NZWindOp();
}
return operator.calculate(curves, EmptyCurves);
}
示例2: pathToCurves
import sun.awt.geom.Curve; //导入方法依赖的package包/类
private static Vector<Curve> pathToCurves(PathIterator pi) {
Vector<Curve> curves = new Vector<>();
int windingRule = pi.getWindingRule();
// coords array is big enough for holding:
// coordinates returned from currentSegment (6)
// OR
// two subdivided quadratic curves (2+4+4=10)
// AND
// 0-1 horizontal splitting parameters
// OR
// 2 parametric equation derivative coefficients
// OR
// three subdivided cubic curves (2+6+6+6=20)
// AND
// 0-2 horizontal splitting parameters
// OR
// 3 parametric equation derivative coefficients
double coords[] = new double[23];
double movx = 0, movy = 0;
double curx = 0, cury = 0;
double newx, newy;
while (!pi.isDone()) {
switch (pi.currentSegment(coords)) {
case PathIterator.SEG_MOVETO:
Curve.insertLine(curves, curx, cury, movx, movy);
curx = movx = coords[0];
cury = movy = coords[1];
Curve.insertMove(curves, movx, movy);
break;
case PathIterator.SEG_LINETO:
newx = coords[0];
newy = coords[1];
Curve.insertLine(curves, curx, cury, newx, newy);
curx = newx;
cury = newy;
break;
case PathIterator.SEG_QUADTO:
newx = coords[2];
newy = coords[3];
Curve.insertQuad(curves, curx, cury, coords);
curx = newx;
cury = newy;
break;
case PathIterator.SEG_CUBICTO:
newx = coords[4];
newy = coords[5];
Curve.insertCubic(curves, curx, cury, coords);
curx = newx;
cury = newy;
break;
case PathIterator.SEG_CLOSE:
Curve.insertLine(curves, curx, cury, movx, movy);
curx = movx;
cury = movy;
break;
}
pi.next();
}
Curve.insertLine(curves, curx, cury, movx, movy);
AreaOp operator;
if (windingRule == PathIterator.WIND_EVEN_ODD) {
operator = new AreaOp.EOWindOp();
} else {
operator = new AreaOp.NZWindOp();
}
return operator.calculate(curves, EmptyCurves);
}
示例3: pathToCurves
import sun.awt.geom.Curve; //导入方法依赖的package包/类
private static Vector pathToCurves(PathIterator pi) {
Vector curves = new Vector();
int windingRule = pi.getWindingRule();
// coords array is big enough for holding:
// coordinates returned from currentSegment (6)
// OR
// two subdivided quadratic curves (2+4+4=10)
// AND
// 0-1 horizontal splitting parameters
// OR
// 2 parametric equation derivative coefficients
// OR
// three subdivided cubic curves (2+6+6+6=20)
// AND
// 0-2 horizontal splitting parameters
// OR
// 3 parametric equation derivative coefficients
double coords[] = new double[23];
double movx = 0, movy = 0;
double curx = 0, cury = 0;
double newx, newy;
while (!pi.isDone()) {
switch (pi.currentSegment(coords)) {
case PathIterator.SEG_MOVETO:
Curve.insertLine(curves, curx, cury, movx, movy);
curx = movx = coords[0];
cury = movy = coords[1];
Curve.insertMove(curves, movx, movy);
break;
case PathIterator.SEG_LINETO:
newx = coords[0];
newy = coords[1];
Curve.insertLine(curves, curx, cury, newx, newy);
curx = newx;
cury = newy;
break;
case PathIterator.SEG_QUADTO:
newx = coords[2];
newy = coords[3];
Curve.insertQuad(curves, curx, cury, coords);
curx = newx;
cury = newy;
break;
case PathIterator.SEG_CUBICTO:
newx = coords[4];
newy = coords[5];
Curve.insertCubic(curves, curx, cury, coords);
curx = newx;
cury = newy;
break;
case PathIterator.SEG_CLOSE:
Curve.insertLine(curves, curx, cury, movx, movy);
curx = movx;
cury = movy;
break;
}
pi.next();
}
Curve.insertLine(curves, curx, cury, movx, movy);
AreaOp operator;
if (windingRule == PathIterator.WIND_EVEN_ODD) {
operator = new AreaOp.EOWindOp();
} else {
operator = new AreaOp.NZWindOp();
}
return operator.calculate(curves, EmptyCurves);
}