Java Code Examples for sun.java2d.SunGraphics2D#STROKE_CUSTOM

The following examples show how to use sun.java2d.SunGraphics2D#STROKE_CUSTOM . 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: PixelToParallelogramConverter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void drawRect(SunGraphics2D sg2d,
                     int x, int y, int w, int h)
{
    if (w >= 0 && h >= 0) {
        if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
            BasicStroke bs = ((BasicStroke) sg2d.stroke);
            if (w > 0 && h > 0) {
                if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                    bs.getDashArray() == null)
                {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                    return;
                }
            } else {
                // Note: This calls the integer version which
                // will verify that the local drawLine optimizations
                // work and call super.drawLine(), if not.
                drawLine(sg2d, x, y, x+w, y+h);
                return;
            }
        }
        super.drawRect(sg2d, x, y, w, h);
    }
}
 
Example 2
Source File: PixelToParallelogramConverter.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public void drawRect(SunGraphics2D sg2d,
                     int x, int y, int w, int h)
{
    if (w >= 0 && h >= 0) {
        if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
            BasicStroke bs = ((BasicStroke) sg2d.stroke);
            if (w > 0 && h > 0) {
                if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                    bs.getDashArray() == null)
                {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                    return;
                }
            } else {
                // Note: This calls the integer version which
                // will verify that the local drawLine optimizations
                // work and call super.drawLine(), if not.
                drawLine(sg2d, x, y, x+w, y+h);
                return;
            }
        }
        super.drawRect(sg2d, x, y, w, h);
    }
}
 
Example 3
Source File: PixelToParallelogramConverter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void drawRect(SunGraphics2D sg2d,
                     int x, int y, int w, int h)
{
    if (w >= 0 && h >= 0) {
        if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
            BasicStroke bs = ((BasicStroke) sg2d.stroke);
            if (w > 0 && h > 0) {
                if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                    bs.getDashArray() == null)
                {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                    return;
                }
            } else {
                // Note: This calls the integer version which
                // will verify that the local drawLine optimizations
                // work and call super.drawLine(), if not.
                drawLine(sg2d, x, y, x+w, y+h);
                return;
            }
        }
        super.drawRect(sg2d, x, y, w, h);
    }
}
 
Example 4
Source File: PixelToParallelogramConverter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void drawRect(SunGraphics2D sg2d,
                     int x, int y, int w, int h)
{
    if (w >= 0 && h >= 0) {
        if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
            BasicStroke bs = ((BasicStroke) sg2d.stroke);
            if (w > 0 && h > 0) {
                if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                    bs.getDashArray() == null)
                {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                    return;
                }
            } else {
                // Note: This calls the integer version which
                // will verify that the local drawLine optimizations
                // work and call super.drawLine(), if not.
                drawLine(sg2d, x, y, x+w, y+h);
                return;
            }
        }
        super.drawRect(sg2d, x, y, w, h);
    }
}
 
Example 5
Source File: PixelToParallelogramConverter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void drawRect(SunGraphics2D sg2d,
                     int x, int y, int w, int h)
{
    if (w >= 0 && h >= 0) {
        if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
            BasicStroke bs = ((BasicStroke) sg2d.stroke);
            if (w > 0 && h > 0) {
                if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                    bs.getDashArray() == null)
                {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                    return;
                }
            } else {
                // Note: This calls the integer version which
                // will verify that the local drawLine optimizations
                // work and call super.drawLine(), if not.
                drawLine(sg2d, x, y, x+w, y+h);
                return;
            }
        }
        super.drawRect(sg2d, x, y, w, h);
    }
}
 
Example 6
Source File: PixelToParallelogramConverter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void fillRectangle(SunGraphics2D sg2d,
                          double rx, double ry,
                          double rw, double rh)
{
    double px, py;
    double dx1, dy1, dx2, dy2;
    AffineTransform txform = sg2d.transform;
    dx1 = txform.getScaleX();
    dy1 = txform.getShearY();
    dx2 = txform.getShearX();
    dy2 = txform.getScaleY();
    px = rx * dx1 + ry * dx2 + txform.getTranslateX();
    py = rx * dy1 + ry * dy2 + txform.getTranslateY();
    dx1 *= rw;
    dy1 *= rw;
    dx2 *= rh;
    dy2 *= rh;
    if (adjustfill &&
        sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM &&
        sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE)
    {
        double newx = normalize(px);
        double newy = normalize(py);
        dx1 = normalize(px + dx1) - newx;
        dy1 = normalize(py + dy1) - newy;
        dx2 = normalize(px + dx2) - newx;
        dy2 = normalize(py + dy2) - newy;
        px = newx;
        py = newy;
    }
    outrenderer.fillParallelogram(sg2d, rx, ry, rx+rw, ry+rh,
                                  px, py, dx1, dy1, dx2, dy2);
}
 
Example 7
Source File: LoopPipe.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        Path2D.Float p2df;
        int transX;
        int transY;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float)s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transX = sg2d.transX;
            transY = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transX = 0;
            transY = 0;
        }
        sg2d.loops.drawPathLoop.DrawPath(sg2d, sg2d.getSurfaceData(),
                                         transX, transY, p2df);
        return;
    }

    if (sg2d.strokeState == SunGraphics2D.STROKE_CUSTOM) {
        fill(sg2d, sg2d.stroke.createStrokedShape(s));
        return;
    }

    ShapeSpanIterator sr = getStrokeSpans(sg2d, s);

    try {
        fillSpans(sg2d, sr);
    } finally {
        sr.dispose();
    }
}
 
Example 8
Source File: PixelToParallelogramConverter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        BasicStroke bs = ((BasicStroke) sg2d.stroke);
        if (s instanceof Rectangle2D) {
            if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                bs.getDashArray() == null)
            {
                Rectangle2D r2d = (Rectangle2D) s;
                double w = r2d.getWidth();
                double h = r2d.getHeight();
                double x = r2d.getX();
                double y = r2d.getY();
                if (w >= 0 && h >= 0) {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                }
                return;
            }
        } else if (s instanceof Line2D) {
            Line2D l2d = (Line2D) s;
            if (drawGeneralLine(sg2d,
                                l2d.getX1(), l2d.getY1(),
                                l2d.getX2(), l2d.getY2()))
            {
                return;
            }
        }
    }

    outpipe.draw(sg2d, s);
}
 
Example 9
Source File: BufferedRenderPipe.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        if (s instanceof Polygon) {
            if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                Polygon p = (Polygon)s;
                drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
                return;
            }
        }
        Path2D.Float p2df;
        int transx, transy;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float)s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        drawPath(sg2d, p2df, transx, transy);
    } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
        try {
            fillSpans(sg2d, si, 0, 0);
        } finally {
            si.dispose();
        }
    } else {
        fill(sg2d, sg2d.stroke.createStrokedShape(s));
    }
}
 
Example 10
Source File: PixelToParallelogramConverter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void fillRectangle(SunGraphics2D sg2d,
                          double rx, double ry,
                          double rw, double rh)
{
    double px, py;
    double dx1, dy1, dx2, dy2;
    AffineTransform txform = sg2d.transform;
    dx1 = txform.getScaleX();
    dy1 = txform.getShearY();
    dx2 = txform.getShearX();
    dy2 = txform.getScaleY();
    px = rx * dx1 + ry * dx2 + txform.getTranslateX();
    py = rx * dy1 + ry * dy2 + txform.getTranslateY();
    dx1 *= rw;
    dy1 *= rw;
    dx2 *= rh;
    dy2 *= rh;
    if (adjustfill &&
        sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM &&
        sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE)
    {
        double newx = normalize(px);
        double newy = normalize(py);
        dx1 = normalize(px + dx1) - newx;
        dy1 = normalize(py + dy1) - newy;
        dx2 = normalize(px + dx2) - newx;
        dy2 = normalize(py + dy2) - newy;
        px = newx;
        py = newy;
    }
    outrenderer.fillParallelogram(sg2d, rx, ry, rx+rw, ry+rh,
                                  px, py, dx1, dy1, dx2, dy2);
}
 
Example 11
Source File: BufferedRenderPipe.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        if (s instanceof Polygon) {
            if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                Polygon p = (Polygon)s;
                drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
                return;
            }
        }
        Path2D.Float p2df;
        int transx, transy;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float)s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        drawPath(sg2d, p2df, transx, transy);
    } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
        try {
            fillSpans(sg2d, si, 0, 0);
        } finally {
            si.dispose();
        }
    } else {
        fill(sg2d, sg2d.stroke.createStrokedShape(s));
    }
}
 
Example 12
Source File: X11Renderer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Delegate to drawPolygon() if possible...
        if (s instanceof Polygon &&
            sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
        {
            Polygon p = (Polygon) s;
            drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
            return;
        }

        // Otherwise we will use drawPath() for
        // high-quality thin paths.
        doPath(sg2d, s, false);
    } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        // REMIND: X11 can handle uniform scaled wide lines
        // and dashed lines itself if we set the appropriate
        // XGC attributes (TBD).
        ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
        try {
            SunToolkit.awtLock();
            try {
                long xgc = validate(sg2d);
                XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
                           si, si.getNativeIterator(),
                           0, 0);
            } finally {
                SunToolkit.awtUnlock();
            }
        } finally {
            si.dispose();
        }
    } else {
        fill(sg2d, sg2d.stroke.createStrokedShape(s));
    }
}
 
Example 13
Source File: PixelToParallelogramConverter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        BasicStroke bs = ((BasicStroke) sg2d.stroke);
        if (s instanceof Rectangle2D) {
            if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                bs.getDashArray() == null)
            {
                Rectangle2D r2d = (Rectangle2D) s;
                double w = r2d.getWidth();
                double h = r2d.getHeight();
                double x = r2d.getX();
                double y = r2d.getY();
                if (w >= 0 && h >= 0) {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                }
                return;
            }
        } else if (s instanceof Line2D) {
            Line2D l2d = (Line2D) s;
            if (drawGeneralLine(sg2d,
                                l2d.getX1(), l2d.getY1(),
                                l2d.getX2(), l2d.getY2()))
            {
                return;
            }
        }
    }

    outpipe.draw(sg2d, s);
}
 
Example 14
Source File: LoopPipe.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        Path2D.Float p2df;
        int transX;
        int transY;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float)s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transX = sg2d.transX;
            transY = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transX = 0;
            transY = 0;
        }
        sg2d.loops.drawPathLoop.DrawPath(sg2d, sg2d.getSurfaceData(),
                                         transX, transY, p2df);
        return;
    }

    if (sg2d.strokeState == SunGraphics2D.STROKE_CUSTOM) {
        fill(sg2d, sg2d.stroke.createStrokedShape(s));
        return;
    }

    ShapeSpanIterator sr = getStrokeSpans(sg2d, s);

    try {
        fillSpans(sg2d, sr);
    } finally {
        sr.dispose();
    }
}
 
Example 15
Source File: XRRenderer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        Path2D.Float p2df;
        int transx, transy;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        drawPath(sg2d, p2df, transx, transy);
    } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
        try {
            fillSpans(sg2d, si, 0, 0);
        } finally {
            si.dispose();
        }
    } else {
        fill(sg2d, sg2d.stroke.createStrokedShape(s));
    }
}
 
Example 16
Source File: PixelToParallelogramConverter.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        BasicStroke bs = ((BasicStroke) sg2d.stroke);
        if (s instanceof Rectangle2D) {
            if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                bs.getDashArray() == null)
            {
                Rectangle2D r2d = (Rectangle2D) s;
                double w = r2d.getWidth();
                double h = r2d.getHeight();
                double x = r2d.getX();
                double y = r2d.getY();
                if (w >= 0 && h >= 0) {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                }
                return;
            }
        } else if (s instanceof Line2D) {
            Line2D l2d = (Line2D) s;
            if (drawGeneralLine(sg2d,
                                l2d.getX1(), l2d.getY1(),
                                l2d.getX2(), l2d.getY2()))
            {
                return;
            }
        }
    }

    outpipe.draw(sg2d, s);
}
 
Example 17
Source File: X11Renderer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Delegate to drawPolygon() if possible...
        if (s instanceof Polygon &&
            sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
        {
            Polygon p = (Polygon) s;
            drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
            return;
        }

        // Otherwise we will use drawPath() for
        // high-quality thin paths.
        doPath(sg2d, s, false);
    } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        // REMIND: X11 can handle uniform scaled wide lines
        // and dashed lines itself if we set the appropriate
        // XGC attributes (TBD).
        ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
        try {
            SunToolkit.awtLock();
            try {
                long xgc = validate(sg2d);
                XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
                           si, si.getNativeIterator(),
                           0, 0);
            } finally {
                SunToolkit.awtUnlock();
            }
        } finally {
            si.dispose();
        }
    } else {
        fill(sg2d, sg2d.stroke.createStrokedShape(s));
    }
}
 
Example 18
Source File: PixelToParallelogramConverter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        BasicStroke bs = ((BasicStroke) sg2d.stroke);
        if (s instanceof Rectangle2D) {
            if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                bs.getDashArray() == null)
            {
                Rectangle2D r2d = (Rectangle2D) s;
                double w = r2d.getWidth();
                double h = r2d.getHeight();
                double x = r2d.getX();
                double y = r2d.getY();
                if (w >= 0 && h >= 0) {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                }
                return;
            }
        } else if (s instanceof Line2D) {
            Line2D l2d = (Line2D) s;
            if (drawGeneralLine(sg2d,
                                l2d.getX1(), l2d.getY1(),
                                l2d.getX2(), l2d.getY2()))
            {
                return;
            }
        }
    }

    outpipe.draw(sg2d, s);
}
 
Example 19
Source File: PixelToParallelogramConverter.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        BasicStroke bs = ((BasicStroke) sg2d.stroke);
        if (s instanceof Rectangle2D) {
            if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
                bs.getDashArray() == null)
            {
                Rectangle2D r2d = (Rectangle2D) s;
                double w = r2d.getWidth();
                double h = r2d.getHeight();
                double x = r2d.getX();
                double y = r2d.getY();
                if (w >= 0 && h >= 0) {
                    double lw = bs.getLineWidth();
                    drawRectangle(sg2d, x, y, w, h, lw);
                }
                return;
            }
        } else if (s instanceof Line2D) {
            Line2D l2d = (Line2D) s;
            if (drawGeneralLine(sg2d,
                                l2d.getX1(), l2d.getY1(),
                                l2d.getX2(), l2d.getY2()))
            {
                return;
            }
        }
    }

    outpipe.draw(sg2d, s);
}
 
Example 20
Source File: PixelToParallelogramConverter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void drawRectangle(SunGraphics2D sg2d,
                          double rx, double ry,
                          double rw, double rh,
                          double lw)
{
    double px, py;
    double dx1, dy1, dx2, dy2;
    double lw1, lw2;
    AffineTransform txform = sg2d.transform;
    dx1 = txform.getScaleX();
    dy1 = txform.getShearY();
    dx2 = txform.getShearX();
    dy2 = txform.getScaleY();
    px = rx * dx1 + ry * dx2 + txform.getTranslateX();
    py = rx * dy1 + ry * dy2 + txform.getTranslateY();
    // lw along dx1,dy1 scale by transformed length of dx2,dy2 vectors
    // and vice versa
    lw1 = len(dx1, dy1) * lw;
    lw2 = len(dx2, dy2) * lw;
    dx1 *= rw;
    dy1 *= rw;
    dx2 *= rh;
    dy2 *= rh;
    if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM &&
        sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE)
    {
        double newx = normalize(px);
        double newy = normalize(py);
        dx1 = normalize(px + dx1) - newx;
        dy1 = normalize(py + dy1) - newy;
        dx2 = normalize(px + dx2) - newx;
        dy2 = normalize(py + dy2) - newy;
        px = newx;
        py = newy;
    }
    lw1 = Math.max(lw1, minPenSize);
    lw2 = Math.max(lw2, minPenSize);
    double len1 = len(dx1, dy1);
    double len2 = len(dx2, dy2);
    if (lw1 >= len1 || lw2 >= len2) {
        // The line widths are large enough to consume the
        // entire hole in the middle of the parallelogram
        // so we can just fill the outer parallelogram.
        fillOuterParallelogram(sg2d,
                               rx, ry, rx+rw, ry+rh,
                               px, py, dx1, dy1, dx2, dy2,
                               len1, len2, lw1, lw2);
    } else {
        outrenderer.drawParallelogram(sg2d,
                                      rx, ry, rx+rw, ry+rh,
                                      px, py, dx1, dy1, dx2, dy2,
                                      lw1 / len1, lw2 / len2);
    }
}