当前位置: 首页>>代码示例>>Java>>正文


Java Curve.insertLine方法代码示例

本文整理汇总了Java中sun.awt.geom.Curve.insertLine方法的典型用法代码示例。如果您正苦于以下问题:Java Curve.insertLine方法的具体用法?Java Curve.insertLine怎么用?Java Curve.insertLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.awt.geom.Curve的用法示例。


在下文中一共展示了Curve.insertLine方法的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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:68,代码来源:Area.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:68,代码来源:Area.java

示例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);
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:68,代码来源:Area.java


注:本文中的sun.awt.geom.Curve.insertLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。