Java Code Examples for sun.dc.pr.Rasterizer#endPath()

The following examples show how to use sun.dc.pr.Rasterizer#endPath() . 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 dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 2
Source File: DuctusRenderingEngine.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 3
Source File: DuctusRenderingEngine.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 4
Source File: DuctusRenderingEngine.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 5
Source File: DuctusRenderingEngine.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 6
Source File: DuctusRenderingEngine.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 7
Source File: DuctusRenderingEngine.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 8
Source File: DuctusRenderingEngine.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 9
Source File: DuctusRenderingEngine.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 10
Source File: DuctusRenderingEngine.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 11
Source File: DuctusRenderingEngine.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
Example 12
Source File: DuctusRenderingEngine.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}