sun.dc.path.PathConsumer Java Examples

The following examples show how to use sun.dc.path.PathConsumer. 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: DuctusRenderingEngine.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #2
Source File: DuctusRenderingEngine.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #3
Source File: DuctusRenderingEngine.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}
 
Example #4
Source File: DuctusRenderingEngine.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #5
Source File: DuctusRenderingEngine.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #6
Source File: DuctusRenderingEngine.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}
 
Example #7
Source File: DuctusRenderingEngine.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #8
Source File: DuctusRenderingEngine.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #9
Source File: DuctusRenderingEngine.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}
 
Example #10
Source File: DuctusRenderingEngine.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #11
Source File: DuctusRenderingEngine.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #12
Source File: DuctusRenderingEngine.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}
 
Example #13
Source File: DuctusRenderingEngine.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #14
Source File: DuctusRenderingEngine.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #15
Source File: DuctusRenderingEngine.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}
 
Example #16
Source File: DuctusRenderingEngine.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #17
Source File: DuctusRenderingEngine.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #18
Source File: DuctusRenderingEngine.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}
 
Example #19
Source File: DuctusRenderingEngine.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #20
Source File: DuctusRenderingEngine.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #21
Source File: DuctusRenderingEngine.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}
 
Example #22
Source File: DuctusRenderingEngine.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #23
Source File: DuctusRenderingEngine.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #24
Source File: DuctusRenderingEngine.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}
 
Example #25
Source File: DuctusRenderingEngine.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #26
Source File: DuctusRenderingEngine.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #27
Source File: DuctusRenderingEngine.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}
 
Example #28
Source File: DuctusRenderingEngine.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void strokeTo(Shape src,
                     AffineTransform transform,
                     BasicStroke bs,
                     boolean thin,
                     boolean normalize,
                     boolean antialias,
                     PathConsumer2D sr)
{
    PathStroker stroker = new PathStroker(sr);
    PathConsumer consumer = stroker;

    float matrix[] = null;
    if (!thin) {
        stroker.setPenDiameter(bs.getLineWidth());
        if (transform != null) {
            matrix = getTransformMatrix(transform);
        }
        stroker.setPenT4(matrix);
        stroker.setPenFitting(PenUnits, MinPenUnits);
    }
    stroker.setCaps(RasterizerCaps[bs.getEndCap()]);
    stroker.setCorners(RasterizerCorners[bs.getLineJoin()],
                       bs.getMiterLimit());
    float[] dashes = bs.getDashArray();
    if (dashes != null) {
        PathDasher dasher = new PathDasher(stroker);
        dasher.setDash(dashes, bs.getDashPhase());
        if (transform != null && matrix == null) {
            matrix = getTransformMatrix(transform);
        }
        dasher.setDashT4(matrix);
        consumer = dasher;
    }

    try {
        PathIterator pi = src.getPathIterator(transform);

        feedConsumer(pi, consumer, normalize, 0.25f);
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    } finally {
        while (consumer != null && consumer != sr) {
            PathConsumer next = consumer.getConsumer();
            consumer.dispose();
            consumer = next;
        }
    }
}
 
Example #29
Source File: DuctusRenderingEngine.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
    try {
        consumer.beginPath();
        boolean pathClosed = false;
        float mx = 0.0f;
        float my = 0.0f;
        float point[]  = new float[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(point);
            if (pathClosed == true) {
                pathClosed = false;
                if (type != PathIterator.SEG_MOVETO) {
                    // Force current point back to last moveto point
                    consumer.beginSubpath(mx, my);
                }
            }
            switch (type) {
            case PathIterator.SEG_MOVETO:
                mx = point[0];
                my = point[1];
                consumer.beginSubpath(point[0], point[1]);
                break;
            case PathIterator.SEG_LINETO:
                consumer.appendLine(point[0], point[1]);
                break;
            case PathIterator.SEG_QUADTO:
                consumer.appendQuadratic(point[0], point[1],
                                         point[2], point[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                consumer.appendCubic(point[0], point[1],
                                     point[2], point[3],
                                     point[4], point[5]);
                break;
            case PathIterator.SEG_CLOSE:
                consumer.closedSubpath();
                pathClosed = true;
                break;
            }
            pi.next();
        }

        consumer.endPath();
    } catch (PathException e) {
        throw new InternalError("Unable to Stroke shape ("+
                                e.getMessage()+")", e);
    }
}
 
Example #30
Source File: DuctusRenderingEngine.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public PathConsumer getConsumer() {
    return null;
}