Package com.google.code.appengine.awt.geom

Examples of com.google.code.appengine.awt.geom.GeneralPath


    //AreaChartProperties areaChartProperties=(AreaChartProperties) iAxisChartDataSet.getChartTypeProperties();

    float xPosition=axisChart.getXAxis().getTickStart();

    GeneralPath generalPaths[]=new GeneralPath[ iAxisChartDataSet.getNumberOfDataSets() ];


    //---cache the computed values
    //float[][] yAxisCoordinates= new float[ iAxisChartDataSet.getNumberOfDataSets() ][ iAxisChartDataSet.getNumberOfDataItems() ];

    //---StackedAreaCharts can not be drawn on a horizontal axis so y-axis will always be the data axis
    DataAxisProperties dataAxisProperties= (DataAxisProperties) axisChart.getAxisProperties().getYAxisProperties();


    float stackedValue=0f;


    //LOOP
    //---initial postion of each line must be set with call to moveTo()
    //---Do this here so every point does not have to check....if( i == 0 )... in loop
    for( int i=0; i < generalPaths.length; i++ )
    {
      generalPaths[ i ]=new GeneralPath();

      generalPaths[ i ].moveTo( xPosition, axisChart.getYAxis().getZeroLineCoordinate() );

      stackedValue+=iAxisChartDataSet.getValue( i, 0 );
      generalPaths[ i ].lineTo( xPosition, axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
View Full Code Here


     */
    protected Shape createShape(int[] xPoints, int[] yPoints, int nPoints,
            boolean close, boolean biased) {
       
        float offset = biased ? (float)bias : 0.0f;
        GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
        if (nPoints > 0) {
            path.moveTo(xPoints[0] + offset, yPoints[0] + offset);
            int lastX = xPoints[0];
            int lastY = yPoints[0];
            if (close && (Math.abs(xPoints[nPoints - 1] - lastX) < 1)
                    && (Math.abs(yPoints[nPoints - 1] - lastY) < 1)) {
                nPoints--;
            }
            for (int i = 1; i < nPoints; i++) {
                if ((Math.abs(xPoints[i] - lastX) > 1)
                        || (Math.abs(yPoints[i] - lastY) > 1)) {
                    path.lineTo(xPoints[i] + offset, yPoints[i] + offset);
                    lastX = xPoints[i];
                    lastY = yPoints[i];
                }
            }
            if (close)
                path.closePath();
        }
        return path;
    }
View Full Code Here

            return shape;
        }

        public void read() throws IOException {
            super.read();
            shape = new GeneralPath();

            noComponents = 0;
            boolean more = true;
            while (more) {
                noComponents++;
                ttf.readUShortFlags();
                more = ttf.flagBit(MORE_COMPONENTS);
                int glyphIndex = ttf.readUShort();
                int arg1, arg2;
                if (ttf.flagBit(ARGS_WORDS)) {
                    arg1 = ttf.readShort();
                    arg2 = ttf.readShort();
                } else {
                    arg1 = ttf.readChar();
                    arg2 = ttf.readChar();
                }
                AffineTransform t = new AffineTransform();
                if (ttf.flagBit(ARGS_XY)) {
                    t.translate(arg1, arg2);
                } else {
                    System.err
                            .println("TTFGlyfTable: ARGS_ARE_POINTS not implemented.");
                }

                if (ttf.flagBit(SCALE)) {
                    double scale = ttf.readF2Dot14();
                    t.scale(scale, scale);
                } else if (ttf.flagBit(XY_SCALE)) {
                    double scaleX = ttf.readF2Dot14();
                    double scaleY = ttf.readF2Dot14();
                    t.scale(scaleX, scaleY);
                } else if (ttf.flagBit(TWO_BY_TWO)) {
                    System.err
                            .println("TTFGlyfTable: WE_HAVE_A_TWO_BY_TWO not implemented.");
                }

                GeneralPath appendGlyph = (GeneralPath) getGlyph(glyphIndex)
                        .getShape().clone();
                appendGlyph.transform(t);
                shape.append(appendGlyph, false);
            }
        }
View Full Code Here

        if(segmentsProp == null) {
            logger.log(POILogger.WARN, "Freeform is missing GEOMETRY__SEGMENTINFO ");
            return null;
        }

        GeneralPath path = new GeneralPath();
        int numPoints = verticesProp.getNumberOfElementsInArray();
        int numSegments = segmentsProp.getNumberOfElementsInArray();
        for (int i = 0, j = 0; i < numSegments && j < numPoints; i++) {
            byte[] elem = segmentsProp.getElement(i);
            if(Arrays.equals(elem, SEGMENTINFO_MOVETO)){
                byte[] p = verticesProp.getElement(j++);
                short x = LittleEndian.getShort(p, 0);
                short y = LittleEndian.getShort(p, 2);
                path.moveTo(
                        ((float)x*POINT_DPI/MASTER_DPI),
                        ((float)y*POINT_DPI/MASTER_DPI));
            } else if (Arrays.equals(elem, SEGMENTINFO_CUBICTO) || Arrays.equals(elem, SEGMENTINFO_CUBICTO2)){
                i++;
                byte[] p1 = verticesProp.getElement(j++);
                short x1 = LittleEndian.getShort(p1, 0);
                short y1 = LittleEndian.getShort(p1, 2);
                byte[] p2 = verticesProp.getElement(j++);
                short x2 = LittleEndian.getShort(p2, 0);
                short y2 = LittleEndian.getShort(p2, 2);
                byte[] p3 = verticesProp.getElement(j++);
                short x3 = LittleEndian.getShort(p3, 0);
                short y3 = LittleEndian.getShort(p3, 2);
                path.curveTo(
                        ((float)x1*POINT_DPI/MASTER_DPI), ((float)y1*POINT_DPI/MASTER_DPI),
                        ((float)x2*POINT_DPI/MASTER_DPI), ((float)y2*POINT_DPI/MASTER_DPI),
                        ((float)x3*POINT_DPI/MASTER_DPI), ((float)y3*POINT_DPI/MASTER_DPI));

            } else if (Arrays.equals(elem, SEGMENTINFO_LINETO)){
                i++;
                byte[] pnext = segmentsProp.getElement(i);
                if(Arrays.equals(pnext, SEGMENTINFO_ESCAPE)){
                    if(j + 1 < numPoints){
                        byte[] p = verticesProp.getElement(j++);
                        short x = LittleEndian.getShort(p, 0);
                        short y = LittleEndian.getShort(p, 2);
                        path.lineTo(
                                ((float)x*POINT_DPI/MASTER_DPI), ((float)y*POINT_DPI/MASTER_DPI));
                    }
                } else if (Arrays.equals(pnext, SEGMENTINFO_CLOSE)){
                    path.closePath();
                }
            }
        }
        return path;
    }
View Full Code Here

        }
        return path;
    }

    public com.google.code.appengine.awt.Shape getOutline(){
        GeneralPath path =  getPath();
        Rectangle2D anchor = getAnchor2D();
        Rectangle2D bounds = path.getBounds2D();
        AffineTransform at = new AffineTransform();
        at.translate(anchor.getX(), anchor.getY());
        at.scale(
                anchor.getWidth()/bounds.getWidth(),
                anchor.getHeight()/bounds.getHeight()
View Full Code Here

            xLast = points[pointSize - 2];
            yLast = points[pointSize - 1];
        }

        GeneralPath createGeneralPath() {
            GeneralPath p = new GeneralPath();
            int j = 0;
            for(int i = 0; i < typeSize; i++) {
                int type = types[i];
                switch(type){
                case PathIterator.SEG_MOVETO:
                    p.moveTo(points[j], points[j + 1]);
                    break;
                case PathIterator.SEG_LINETO:
                    p.lineTo(points[j], points[j + 1]);
                    break;
                case PathIterator.SEG_QUADTO:
                    p.quadTo(points[j], points[j + 1], points[j + 2], points[j + 3]);
                    break;
                case PathIterator.SEG_CUBICTO:
                    p.curveTo(points[j], points[j + 1], points[j + 2], points[j + 3], points[j + 4], points[j + 5]);
                    break;
                case PathIterator.SEG_CLOSE:
                    p.closePath();
                    break;
                }
                j += pointShift[type];
            }
            return p;
View Full Code Here

    }

    public Shape getOutline(AffineTransform xform) {
        breaker.createAllSegments();

        GeneralPath outline = breaker.getOutline();

        if (outline != null && xform != null) {
            outline.transform(xform);
        }

        return outline;
    }
View Full Code Here

     * @param renderer EMFRenderer storing the drawing session data
     * @param closePath if true the path is closed and filled
     */
    protected void render(EMFRenderer renderer, boolean closePath) {
        // create a GeneralPath containing GeneralPathes
        GeneralPath path = new GeneralPath(
            renderer.getWindingRule());

        // iterate the polgons
        Point p;
        for (int polygon = 0; polygon < numberOfPoints.length; polygon++) {

            // create a new member of path
            GeneralPath gp = new GeneralPath(
                renderer.getWindingRule());
            for (int point = 0; point < numberOfPoints[polygon]; point ++) {
                // add a point to gp
                p = points[polygon][point];
                if (point > 0) {
                    gp.lineTo((float) p.getX()(float)p.getY());
                } else {
                    gp.moveTo((float) p.getX()(float)p.getY());
                }
            }

            // close the member, add it to path
            if (closePath) {
                gp.closePath();
            }

            path.append(gp, false);
        }

View Full Code Here

     * displays the tag using the renderer
     *
     * @param renderer EMFRenderer storing the drawing session data
     */
    public void render(EMFRenderer renderer) {
        GeneralPath currentPath = renderer.getPath();
        // fills the current path
        if (currentPath != null) {
            renderer.fillShape(currentPath);
            renderer.drawShape(currentPath);
            renderer.setPath(null);
View Full Code Here

     * displays the tag using the renderer
     *
     * @param renderer EMFRenderer storing the drawing session data
     */
    public void render(EMFRenderer renderer) {
        GeneralPath currentPath = renderer.getPath();
        // fills the current path
        if (currentPath != null) {
            renderer.fillShape(currentPath);
            renderer.setPath(null);
        }
View Full Code Here

TOP

Related Classes of com.google.code.appengine.awt.geom.GeneralPath

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.