Search in sources :

Example 1 with PathDasher

use of sun.dc.pr.PathDasher in project jdk8u_jdk by JetBrains.

the class DuctusRenderingEngine method strokeTo.

/**
     * {@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;
        }
    }
}
Also used : PathException(sun.dc.path.PathException) PathIterator(java.awt.geom.PathIterator) PathConsumer(sun.dc.path.PathConsumer) PathDasher(sun.dc.pr.PathDasher) PathStroker(sun.dc.pr.PathStroker)

Example 2 with PathDasher

use of sun.dc.pr.PathDasher in project jdk8u_jdk by JetBrains.

the class DuctusRenderingEngine method createStrokedShape.

/**
     * {@inheritDoc}
     */
@Override
public Shape createStrokedShape(Shape src, float width, int caps, int join, float miterlimit, float[] dashes, float dashphase) {
    FillAdapter filler = new FillAdapter();
    PathStroker stroker = new PathStroker(filler);
    PathDasher dasher = null;
    try {
        PathConsumer consumer;
        stroker.setPenDiameter(width);
        stroker.setPenT4(null);
        stroker.setCaps(RasterizerCaps[caps]);
        stroker.setCorners(RasterizerCorners[join], miterlimit);
        if (dashes != null) {
            dasher = new PathDasher(stroker);
            dasher.setDash(dashes, dashphase);
            dasher.setDashT4(null);
            consumer = dasher;
        } else {
            consumer = stroker;
        }
        feedConsumer(consumer, src.getPathIterator(null));
    } finally {
        stroker.dispose();
        if (dasher != null) {
            dasher.dispose();
        }
    }
    return filler.getShape();
}
Also used : PathConsumer(sun.dc.path.PathConsumer) PathDasher(sun.dc.pr.PathDasher) PathStroker(sun.dc.pr.PathStroker)

Aggregations

PathConsumer (sun.dc.path.PathConsumer)2 PathDasher (sun.dc.pr.PathDasher)2 PathStroker (sun.dc.pr.PathStroker)2 PathIterator (java.awt.geom.PathIterator)1 PathException (sun.dc.path.PathException)1