Package com.google.code.appengine.awt

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


        // only BasisStrokes are written
        if (!(s instanceof BasicStroke)) {
            return result;
        }

        BasicStroke stroke = (BasicStroke) s;

        // append linecap
        if (all || (stroke.getEndCap() != defaultStroke.getEndCap())) {
            // append cap
            switch (stroke.getEndCap()) {
                default:
                case BasicStroke.CAP_BUTT:
                    result.put("stroke-linecap", "butt");
                    break;
                case BasicStroke.CAP_ROUND:
                    result.put("stroke-linecap", "round");
                    break;
                case BasicStroke.CAP_SQUARE:
                    result.put("stroke-linecap", "square");
                    break;
            }
        }

        // append dasharray
        if (all
                || !Arrays.equals(stroke.getDashArray(), defaultStroke
                        .getDashArray())) {
            if (stroke.getDashArray() != null
                    && stroke.getDashArray().length > 0) {
                StringBuffer array = new StringBuffer();
                for (int i = 0; i < stroke.getDashArray().length; i++) {
                    if (i > 0) {
                        array.append(",");
                    }
                    // SVG does not allow dash entry to be zero (Firefox 2.0).
                    float dash = stroke.getDashArray()[i];
                    array.append(fixedPrecision(dash > 0 ? dash : 0.1));
                }
                result.put("stroke-dasharray", array.toString());
            } else {
                result.put("stroke-dasharray", "none");
            }
        }

        if (all || (stroke.getDashPhase() != defaultStroke.getDashPhase())) {
            result.put("stroke-dashoffset", fixedPrecision(stroke.getDashPhase()));
        }

        // append meter limit
        if (all || (stroke.getMiterLimit() != defaultStroke.getMiterLimit())) {
            result.put("stroke-miterlimit", fixedPrecision(stroke.getMiterLimit()));
        }

        // append join
        if (all || (stroke.getLineJoin() != defaultStroke.getLineJoin())) {
            switch (stroke.getLineJoin()) {
                default:
                case BasicStroke.JOIN_MITER:
                    result.put("stroke-linejoin", "miter");
                    break;
                case BasicStroke.JOIN_ROUND:
                    result.put("stroke-linejoin", "round");
                    break;
                case BasicStroke.JOIN_BEVEL:
                    result.put("stroke-linejoin", "bevel");
                    break;
            }
        }

        // append linewidth
        if (all || (stroke.getLineWidth() != defaultStroke.getLineWidth())) {
            // width of 0 means thinnest line, which does not exist in SVG
            if (stroke.getLineWidth() == 0) {
                result.put("stroke-width", fixedPrecision(0.000001f));
            } else {
                result.put("stroke-width", fixedPrecision(stroke.getLineWidth()));
            }
        }

        return result;
    }
View Full Code Here


        deviceClip = (size != null ? new Rectangle(0, 0, size.width,
                size.height) : null);
        userClip = null;
        currentTransform = new AffineTransform();
        currentComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER);
        currentStroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE,
                BasicStroke.JOIN_MITER, 10.0f, null, 0.0f);

        super.setColor(Color.BLACK);
        super.setBackground(Color.BLACK);
        super.setFont(new Font("Dialog", Font.PLAIN, 12));
View Full Code Here

     * will call writeWidth, writeCap, writeJoin, writeMiterLimit and writeDash,
     * if any were different than the current stroke.
     */
    protected void writeStroke(Stroke stroke) throws IOException {
        if (stroke instanceof BasicStroke) {
            BasicStroke ns = (BasicStroke) stroke;

            // get the current values for comparison if available,
            // otherwise set them to -1="undefined"
            int currentCap = -1, currentJoin = -1;
            float currentWidth = -1, currentLimit = -1, currentDashPhase = -1;
            float[] currentDashArray = null;
            if ((currentStroke != null)
                    && (currentStroke instanceof BasicStroke)) {
                BasicStroke cs = (BasicStroke) currentStroke;
                currentCap = cs.getEndCap();
                currentJoin = cs.getLineJoin();
                currentWidth = cs.getLineWidth();
                currentLimit = cs.getMiterLimit();
                currentDashArray = cs.getDashArray();
                currentDashPhase = cs.getDashPhase();
            }

            // Check the linewidth.
            float width = ns.getLineWidth();
            if (currentWidth != width) {
View Full Code Here

    ChartProperties chartProperties = new ChartProperties();
    AxisProperties axisProperties = new AxisProperties( false );

    axisProperties.getYAxisProperties().setShowGridLines( AxisTypeProperties.GRID_LINES_ALL );
    axisProperties.getYAxisProperties().setAxisStroke( new ChartStroke( new BasicStroke( 1.5f ), Color.red ) );
      axisProperties.getYAxisProperties().setGridLineChartStroke( new ChartStroke( new BasicStroke( 1.5f ), Color.red ) );

    //axisProperties.setXAxisLabelsAreVertical( true );


    DataAxisProperties yAxis = (DataAxisProperties) axisProperties.getYAxisProperties();
View Full Code Here

    }

    public void setLineWidth(double width) {
        Stroke stroke = getStroke();
        if (stroke instanceof BasicStroke) {
            BasicStroke cs = (BasicStroke) stroke;
            if (cs.getLineWidth() != width) {
                stroke = new BasicStroke((float) width, cs.getEndCap(), cs
                        .getLineJoin(), cs.getMiterLimit(), cs.getDashArray(),
                        cs.getDashPhase());
                setStroke(stroke);
            }
        } else {
            stroke = new BasicStroke((float) width);
            setStroke(stroke);
        }
    }
View Full Code Here

    Stroke[] strokes = new Stroke[ numberOfDataSets ];
    for( int j = 0; j < numberOfDataSets; j++ )
    {
      strokes[ j ] = LineChartProperties.DEFAULT_LINE_STROKE;
    }
    strokes[ 0 ] = new BasicStroke( 3.0f );

    Shape[] shapes = new Shape[ numberOfDataSets ];
    for( int j = 0; j < numberOfDataSets; j++ )
    {
      shapes[ j ] = PointChartProperties.SHAPE_DIAMOND;
View Full Code Here

   ******************************************************************************************/
  private static PieChartDataSet getPieChartDataSet( int numToCreate, int minValue, int maxValue ) throws ChartDataException
  {
    PieChart2DProperties properties = new PieChart2DProperties();
    //properties.setZeroDegreeOffset( (float) TestDataGenerator.getRandomNumber( 0, 500 ) );
    properties.setBorderChartStroke( new ChartStroke( new BasicStroke( 1.0f ), TestDataGenerator.getRandomPaint() ) );

    String[] labels = TestDataGenerator.getRandomStrings( numToCreate, (int) TestDataGenerator.getRandomNumber( 3, 20 ), false );
    Paint[] paints = TestDataGenerator.getRandomPaints( numToCreate );

    return new PieChartDataSet( "This is a test title", TestDataGenerator.getRandomNumbers( numToCreate, minValue, maxValue ), labels, paints, properties );
View Full Code Here

    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof BasicStroke) {
            BasicStroke bs = (BasicStroke)obj;
            return
                bs.width == width &&
                bs.cap == cap &&
                bs.join == join &&
                bs.miterLimit == miterLimit &&
View Full Code Here

    @Override
    public void draw(Graphics2D g2, float x, float y) {
        AffineTransform at = AffineTransform.getTranslateInstance(x, y);
        if (fStroke == STROKE){
            Stroke oldStroke = g2.getStroke();
            g2.setStroke(new BasicStroke());
            g2.draw(at.createTransformedShape(fShape));
            g2.setStroke(oldStroke);
        } else {
            g2.fill(at.createTransformedShape(fShape));
        }
View Full Code Here

                getJoin(penStyle),
                renderer.getMeterLimit(),
                getDash(penStyle, style),
                0);
        } else {
            return new BasicStroke(
                width,
                getCap(penStyle),
                getJoin(penStyle),
                renderer.getMeterLimit(),
                getDash(penStyle, style),
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.