Java Code Examples for sun.awt.geom.PathConsumer2D#lineTo()

The following examples show how to use sun.awt.geom.PathConsumer2D#lineTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Stroker.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void pop(PathConsumer2D io) {
    numCurves--;
    int type = curveTypes[numCurves];
    end -= (type - 2);
    switch(type) {
    case 8:
        io.curveTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3],
                   curves[end+4], curves[end+5]);
        break;
    case 6:
        io.quadTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3]);
         break;
    case 4:
        io.lineTo(curves[end], curves[end+1]);
    }
}
 
Example 2
Source File: Stroker.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void pop(PathConsumer2D io) {
    numCurves--;
    int type = curveTypes[numCurves];
    end -= (type - 2);
    switch(type) {
    case 8:
        io.curveTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3],
                   curves[end+4], curves[end+5]);
        break;
    case 6:
        io.quadTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3]);
         break;
    case 4:
        io.lineTo(curves[end], curves[end+1]);
    }
}
 
Example 3
Source File: Stroker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void pop(PathConsumer2D io) {
    numCurves--;
    int type = curveTypes[numCurves];
    end -= (type - 2);
    switch(type) {
    case 8:
        io.curveTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3],
                   curves[end+4], curves[end+5]);
        break;
    case 6:
        io.quadTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3]);
         break;
    case 4:
        io.lineTo(curves[end], curves[end+1]);
    }
}
 
Example 4
Source File: Stroker.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void pop(PathConsumer2D io) {
    numCurves--;
    int type = curveTypes[numCurves];
    end -= (type - 2);
    switch(type) {
    case 8:
        io.curveTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3],
                   curves[end+4], curves[end+5]);
        break;
    case 6:
        io.quadTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3]);
         break;
    case 4:
        io.lineTo(curves[end], curves[end+1]);
    }
}
 
Example 5
Source File: Stroker.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void pop(PathConsumer2D io) {
    numCurves--;
    int type = curveTypes[numCurves];
    end -= (type - 2);
    switch(type) {
    case 8:
        io.curveTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3],
                   curves[end+4], curves[end+5]);
        break;
    case 6:
        io.quadTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3]);
         break;
    case 4:
        io.lineTo(curves[end], curves[end+1]);
    }
}
 
Example 6
Source File: Stroker.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void pop(PathConsumer2D io) {
    numCurves--;
    int type = curveTypes[numCurves];
    end -= (type - 2);
    switch(type) {
    case 8:
        io.curveTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3],
                   curves[end+4], curves[end+5]);
        break;
    case 6:
        io.quadTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3]);
         break;
    case 4:
        io.lineTo(curves[end], curves[end+1]);
    }
}
 
Example 7
Source File: Stroker.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void pop(PathConsumer2D io) {
    numCurves--;
    int type = curveTypes[numCurves];
    end -= (type - 2);
    switch(type) {
    case 8:
        io.curveTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3],
                   curves[end+4], curves[end+5]);
        break;
    case 6:
        io.quadTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3]);
         break;
    case 4:
        io.lineTo(curves[end], curves[end+1]);
    }
}
 
Example 8
Source File: Stroker.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void pop(PathConsumer2D io) {
    numCurves--;
    int type = curveTypes[numCurves];
    end -= (type - 2);
    switch(type) {
    case 8:
        io.curveTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3],
                   curves[end+4], curves[end+5]);
        break;
    case 6:
        io.quadTo(curves[end+0], curves[end+1],
                   curves[end+2], curves[end+3]);
         break;
    case 4:
        io.lineTo(curves[end], curves[end+1]);
    }
}
 
Example 9
Source File: RenderingEngine.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility method to feed a {@link PathConsumer2D} object from a
 * given {@link PathIterator}.
 * This method deals with the details of running the iterator and
 * feeding the consumer a segment at a time.
 */
public static void feedConsumer(PathIterator pi, PathConsumer2D consumer) {
    float coords[] = new float[6];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            consumer.moveTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_LINETO:
            consumer.lineTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_QUADTO:
            consumer.quadTo(coords[0], coords[1],
                            coords[2], coords[3]);
            break;
        case PathIterator.SEG_CUBICTO:
            consumer.curveTo(coords[0], coords[1],
                             coords[2], coords[3],
                             coords[4], coords[5]);
            break;
        case PathIterator.SEG_CLOSE:
            consumer.closePath();
            break;
        }
        pi.next();
    }
}
 
Example 10
Source File: TransformingPathConsumer2D.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void emitCurrent(final int type, final float[] pts,
                        final int off, final PathConsumer2D out)
{
    // if instead of switch (perf + most probable cases first)
    if (type == 8) {
        out.curveTo(pts[off + 2], pts[off + 3],
                    pts[off + 4], pts[off + 5],
                    pts[off + 6], pts[off + 7]);
    } else if (type == 4) {
        out.lineTo(pts[off + 2], pts[off + 3]);
    } else {
        out.quadTo(pts[off + 2], pts[off + 3],
                   pts[off + 4], pts[off + 5]);
    }
}
 
Example 11
Source File: MarlinRenderingEngine.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void pathToLoop(final float[] coords, final PathIterator pi,
                               final PathConsumer2D pc2d)
{
    for (; !pi.isDone(); pi.next()) {
        switch (pi.currentSegment(coords)) {
            case PathIterator.SEG_MOVETO:
                pc2d.moveTo(coords[0], coords[1]);
                continue;
            case PathIterator.SEG_LINETO:
                pc2d.lineTo(coords[0], coords[1]);
                continue;
            case PathIterator.SEG_QUADTO:
                pc2d.quadTo(coords[0], coords[1],
                            coords[2], coords[3]);
                continue;
            case PathIterator.SEG_CUBICTO:
                pc2d.curveTo(coords[0], coords[1],
                             coords[2], coords[3],
                             coords[4], coords[5]);
                continue;
            case PathIterator.SEG_CLOSE:
                pc2d.closePath();
                continue;
            default:
        }
    }
    pc2d.pathDone();
}
 
Example 12
Source File: RenderingEngine.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility method to feed a {@link PathConsumer2D} object from a
 * given {@link PathIterator}.
 * This method deals with the details of running the iterator and
 * feeding the consumer a segment at a time.
 */
public static void feedConsumer(PathIterator pi, PathConsumer2D consumer) {
    float coords[] = new float[6];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            consumer.moveTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_LINETO:
            consumer.lineTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_QUADTO:
            consumer.quadTo(coords[0], coords[1],
                            coords[2], coords[3]);
            break;
        case PathIterator.SEG_CUBICTO:
            consumer.curveTo(coords[0], coords[1],
                             coords[2], coords[3],
                             coords[4], coords[5]);
            break;
        case PathIterator.SEG_CLOSE:
            consumer.closePath();
            break;
        }
        pi.next();
    }
}
 
Example 13
Source File: RenderingEngine.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility method to feed a {@link PathConsumer2D} object from a
 * given {@link PathIterator}.
 * This method deals with the details of running the iterator and
 * feeding the consumer a segment at a time.
 */
public static void feedConsumer(PathIterator pi, PathConsumer2D consumer) {
    float coords[] = new float[6];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            consumer.moveTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_LINETO:
            consumer.lineTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_QUADTO:
            consumer.quadTo(coords[0], coords[1],
                            coords[2], coords[3]);
            break;
        case PathIterator.SEG_CUBICTO:
            consumer.curveTo(coords[0], coords[1],
                             coords[2], coords[3],
                             coords[4], coords[5]);
            break;
        case PathIterator.SEG_CLOSE:
            consumer.closePath();
            break;
        }
        pi.next();
    }
}
 
Example 14
Source File: RenderingEngine.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility method to feed a {@link PathConsumer2D} object from a
 * given {@link PathIterator}.
 * This method deals with the details of running the iterator and
 * feeding the consumer a segment at a time.
 */
public static void feedConsumer(PathIterator pi, PathConsumer2D consumer) {
    float coords[] = new float[6];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            consumer.moveTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_LINETO:
            consumer.lineTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_QUADTO:
            consumer.quadTo(coords[0], coords[1],
                            coords[2], coords[3]);
            break;
        case PathIterator.SEG_CUBICTO:
            consumer.curveTo(coords[0], coords[1],
                             coords[2], coords[3],
                             coords[4], coords[5]);
            break;
        case PathIterator.SEG_CLOSE:
            consumer.closePath();
            break;
        }
        pi.next();
    }
}
 
Example 15
Source File: Helpers.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
void pullAll(final float[] points, final PathConsumer2D io) {
    final int nc = end;
    if (nc == 0) {
        return;
    }
    final int[] _values = indices;

    for (int i = 0, j; i < nc; i++) {
        j = _values[i] << 1;
        io.lineTo(points[j], points[j + 1]);
    }
    end = 0;
}
 
Example 16
Source File: Helpers.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
void pullAll(final float[] points, final PathConsumer2D io) {
    final int nc = end;
    if (nc == 0) {
        return;
    }
    final int[] _values = indices;

    for (int i = 0, j; i < nc; i++) {
        j = _values[i] << 1;
        io.lineTo(points[j], points[j + 1]);
    }
    end = 0;
}
 
Example 17
Source File: RenderingEngine.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility method to feed a {@link PathConsumer2D} object from a
 * given {@link PathIterator}.
 * This method deals with the details of running the iterator and
 * feeding the consumer a segment at a time.
 */
public static void feedConsumer(PathIterator pi, PathConsumer2D consumer) {
    float coords[] = new float[6];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            consumer.moveTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_LINETO:
            consumer.lineTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_QUADTO:
            consumer.quadTo(coords[0], coords[1],
                            coords[2], coords[3]);
            break;
        case PathIterator.SEG_CUBICTO:
            consumer.curveTo(coords[0], coords[1],
                             coords[2], coords[3],
                             coords[4], coords[5]);
            break;
        case PathIterator.SEG_CLOSE:
            consumer.closePath();
            break;
        }
        pi.next();
    }
}
 
Example 18
Source File: Helpers.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
void pullAll(final PathConsumer2D io) {
    final int nc = numCurves;
    if (nc == 0) {
        return;
    }
    if (DO_STATS) {
        // update used marks:
        if (numCurves > curveTypesUseMark) {
            curveTypesUseMark = numCurves;
        }
        if (end > curvesUseMark) {
            curvesUseMark = end;
        }
    }
    final byte[]  _curveTypes = curveTypes;
    final float[] _curves = curves;
    int e = 0;

    for (int i = 0; i < nc; i++) {
        switch(_curveTypes[i]) {
        case TYPE_LINETO:
            io.lineTo(_curves[e], _curves[e+1]);
            e += 2;
            continue;
        case TYPE_CUBICTO:
            io.curveTo(_curves[e],   _curves[e+1],
                       _curves[e+2], _curves[e+3],
                       _curves[e+4], _curves[e+5]);
            e += 6;
            continue;
        case TYPE_QUADTO:
            io.quadTo(_curves[e],   _curves[e+1],
                      _curves[e+2], _curves[e+3]);
            e += 4;
            continue;
        default:
        }
    }
    numCurves = 0;
    end = 0;
}
 
Example 19
Source File: Helpers.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
void popAll(final PathConsumer2D io) {
    int nc = numCurves;
    if (nc == 0) {
        return;
    }
    if (DO_STATS) {
        // update used marks:
        if (numCurves > curveTypesUseMark) {
            curveTypesUseMark = numCurves;
        }
        if (end > curvesUseMark) {
            curvesUseMark = end;
        }
    }
    final byte[]  _curveTypes = curveTypes;
    final float[] _curves = curves;
    int e  = end;

    while (nc != 0) {
        switch(_curveTypes[--nc]) {
        case TYPE_LINETO:
            e -= 2;
            io.lineTo(_curves[e], _curves[e+1]);
            continue;
        case TYPE_CUBICTO:
            e -= 6;
            io.curveTo(_curves[e],   _curves[e+1],
                       _curves[e+2], _curves[e+3],
                       _curves[e+4], _curves[e+5]);
            continue;
        case TYPE_QUADTO:
            e -= 4;
            io.quadTo(_curves[e],   _curves[e+1],
                      _curves[e+2], _curves[e+3]);
            continue;
        default:
        }
    }
    numCurves = 0;
    end = 0;
}
 
Example 20
Source File: Helpers.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
void popAll(final PathConsumer2D io) {
    int nc = numCurves;
    if (nc == 0) {
        return;
    }
    if (DO_STATS) {
        // update used marks:
        if (numCurves > curveTypesUseMark) {
            curveTypesUseMark = numCurves;
        }
        if (end > curvesUseMark) {
            curvesUseMark = end;
        }
    }
    final byte[]  _curveTypes = curveTypes;
    final float[] _curves = curves;
    int e  = end;

    while (nc != 0) {
        switch(_curveTypes[--nc]) {
        case TYPE_LINETO:
            e -= 2;
            io.lineTo(_curves[e], _curves[e+1]);
            continue;
        case TYPE_CUBICTO:
            e -= 6;
            io.curveTo(_curves[e],   _curves[e+1],
                       _curves[e+2], _curves[e+3],
                       _curves[e+4], _curves[e+5]);
            continue;
        case TYPE_QUADTO:
            e -= 4;
            io.quadTo(_curves[e],   _curves[e+1],
                      _curves[e+2], _curves[e+3]);
            continue;
        default:
        }
    }
    numCurves = 0;
    end = 0;
}