Package com.google.code.appengine.awt

Examples of com.google.code.appengine.awt.BasicStroke


            int join,
            float miterlimit,
            float dash[],
            float dash_phase) {

            stroke = new BasicStroke(width, cap, join, miterlimit, dash, dash_phase);
        }
View Full Code Here


         */
        private void getStrokes(BasicMetrics metrics) {
            if (!haveStrokes) {
                if (strikeThrough) {
                    strikeThroughStroke =
                            new BasicStroke(
                                    metrics.strikethroughThickness,
                                    BasicStroke.CAP_BUTT,
                                    BasicStroke.JOIN_MITER,
                                    10
                            );
                }

                if (ulOn) {
                    ulStroke =
                            new BasicStroke(
                                    metrics.underlineThickness,
                                    BasicStroke.CAP_BUTT,
                                    BasicStroke.JOIN_MITER,
                                    10
                            );
View Full Code Here

    @Override
    public void draw(Shape s) {
        if (stroke instanceof BasicStroke && ((BasicStroke)stroke).getLineWidth() <= 1) {
            //TODO: Think about drawing the shape in one fillMultiRectArea call
            BasicStroke bstroke = (BasicStroke)stroke;
            JavaLineRasterizer.LineDasher ld = (bstroke.getDashArray() == null)?null:new JavaLineRasterizer.LineDasher(bstroke.getDashArray(), bstroke.getDashPhase());
            PathIterator pi = s.getPathIterator(transform, 0.5);
            float []points = new float[6];
            int x1 = Integer.MIN_VALUE;
            int y1 = Integer.MIN_VALUE;
            int cx1 = Integer.MIN_VALUE;
View Full Code Here

        if (debugOutput) {
            System.err.println("CommonGraphics2D.drawLine("+x1+", "+y1+", "+x2+", "+y2+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
        }

        if (stroke instanceof BasicStroke && ((BasicStroke)stroke).getLineWidth() <= 1) {
            BasicStroke bstroke = (BasicStroke)stroke;
            Point p1 = new Point(x1, y1);
            Point p2 = new Point(x2, y2);
            transform.transform(p1, p1);
            transform.transform(p2, p2);
            JavaLineRasterizer.LineDasher ld = (bstroke.getDashArray() == null)?null:new JavaLineRasterizer.LineDasher(bstroke.getDashArray(), bstroke.getDashPhase());
            MultiRectArea mra = JavaLineRasterizer.rasterize(p1.x, p1.y, p2.x, p2.y, null, ld, false);
            fillMultiRectArea(mra);
            return;
        }
        draw(new Line2D.Float(x1, y1, x2, y2));
View Full Code Here

                // These two are supposed to be taken from the .AFM file
                //int UnderlinePosition = -100;
                int UnderlineThickness = 50;
                //
                double d = asPoints((double)UnderlineThickness, (int)fontSize);
                setStroke(new BasicStroke((float)d));
                y = (float)((double)(y) + asPoints((double)(UnderlineThickness), (int)fontSize));
                Line2D line = new Line2D.Double((double)x, (double)y, (double)(width+x), (double)y);
                draw(line);
            }
        }
View Full Code Here

    }

    private Stroke transformStroke(Stroke stroke) {
        if (!(stroke instanceof BasicStroke))
            return stroke;
        BasicStroke st = (BasicStroke)stroke;
        float scale = (float)Math.sqrt(Math.abs(transform.getDeterminant()));
        float dash[] = st.getDashArray();
        if (dash != null) {
            for (int k = 0; k < dash.length; ++k)
                dash[k] *= scale;
        }
        return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
    }
View Full Code Here

    private void setStrokeDiff(Stroke newStroke, Stroke oldStroke) {
        if (newStroke == oldStroke)
            return;
        if (!(newStroke instanceof BasicStroke))
            return;
        BasicStroke nStroke = (BasicStroke)newStroke;
        boolean oldOk = (oldStroke instanceof BasicStroke);
        BasicStroke oStroke = null;
        if (oldOk)
            oStroke = (BasicStroke)oldStroke;
        if (!oldOk || nStroke.getLineWidth() != oStroke.getLineWidth())
            cb.setLineWidth(nStroke.getLineWidth());
        if (!oldOk || nStroke.getEndCap() != oStroke.getEndCap()) {
            switch (nStroke.getEndCap()) {
            case BasicStroke.CAP_BUTT:
                cb.setLineCap(0);
                break;
            case BasicStroke.CAP_SQUARE:
                cb.setLineCap(2);
                break;
            default:
                cb.setLineCap(1);
            }
        }
        if (!oldOk || nStroke.getLineJoin() != oStroke.getLineJoin()) {
            switch (nStroke.getLineJoin()) {
            case BasicStroke.JOIN_MITER:
                cb.setLineJoin(0);
                break;
            case BasicStroke.JOIN_BEVEL:
                cb.setLineJoin(2);
                break;
            default:
                cb.setLineJoin(1);
            }
        }
        if (!oldOk || nStroke.getMiterLimit() != oStroke.getMiterLimit())
            cb.setMiterLimit(nStroke.getMiterLimit());
        boolean makeDash;
        if (oldOk) {
            if (nStroke.getDashArray() != null) {
                if (nStroke.getDashPhase() != oStroke.getDashPhase()) {
                    makeDash = true;
                }
                else if (!java.util.Arrays.equals(nStroke.getDashArray(), oStroke.getDashArray())) {
                    makeDash = true;
                }
                else
                    makeDash = false;
            }
            else if (oStroke.getDashArray() != null) {
                makeDash = true;
            }
            else
                makeDash = false;
        }
View Full Code Here

TOP

Related Classes of com.google.code.appengine.awt.BasicStroke

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.