Package com.jgraph.gaeawt.java.awt.geom

Examples of com.jgraph.gaeawt.java.awt.geom.GeneralPath$Iterator


    }

    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


            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

     * @param firstEndpoint - start position
     * @param secondEndpoint - end position
     * @return black box bounds shape
     */
    public Shape getBlackBoxBounds(int firstEndpoint, int secondEndpoint) {
        GeneralPath bounds = new GeneralPath();

        TextRunSegment segment;

        for (int idx = firstEndpoint; idx < secondEndpoint; idx=segment.getEnd()) {
            segment = runSegments.get(logical2segment[idx]);
            bounds.append(segment.getCharsBlackBoxBounds(idx, secondEndpoint), false);
        }

        return bounds;
    }
View Full Code Here

    /**
     * Creates outline shape for the managed text
     * @return outline
     */
    public GeneralPath getOutline() {
        GeneralPath outline = new GeneralPath();

        TextRunSegment segment;

        for (int i = 0; i < runSegments.size(); i++) {
            segment = runSegments.get(i);
            outline.append(segment.getOutline(), false);
        }

        return outline;
    }
View Full Code Here

        pointIndex += count;
        return type;
    }
   
    Shape getShape() {
        GeneralPath gp = new GeneralPath();
       
        gp.append(this, false);
       
        return gp;       
    }
View Full Code Here

            Rectangle2D blackBox = vector[glyphIndex].getGlyphMetrics().getBounds2D();
            at.translate(visualPositions[idx], visualPositions[idx+1]);
            return(at.createTransformedShape(blackBox));
        }

        GeneralPath shape = (GeneralPath)this.getGlyphOutline(glyphIndex);
        shape.transform(at);
        return shape.getBounds2D();
    }
View Full Code Here

            double xOffs = x + visualPositions[idx] + fontTransform.getTranslateX();
            double yOffs = y + visualPositions[idx+1] + fontTransform.getTranslateY();
            return new Rectangle((int)xOffs, (int)yOffs, 0, 0);
        }

        GeneralPath shape = (GeneralPath)this.getGlyphOutline(glyphIndex);

        AffineTransform at = AffineTransform.getTranslateInstance(x, y);

        if (frc != null){
            at.concatenate(frc.getTransform());
       
/*          if (frc.usesFractionalMetrics()){
                shape.transform(at);
                Rectangle2D bounds = shape.getBounds2D();
                Rectangle rect = new Rectangle();
                rect.setRect(bounds);
                return rect;
            }*/
        }
       
        shape.transform(at);

        Rectangle bounds = shape.getBounds();
        return new Rectangle((int)bounds.getX(), (int)bounds.getY(),
                            (int)bounds.getWidth()-1, (int)bounds.getHeight()-1);
        }
View Full Code Here

        if (gvShapes[glyphIndex] == null) {
            gvShapes[glyphIndex] = vector[glyphIndex].getShape();
        }

        GeneralPath gp = (GeneralPath)((GeneralPath)gvShapes[glyphIndex]).clone();

        /* Applying GlyphVector font transform */
        AffineTransform at = (AffineTransform)this.transform.clone();

        /* Applying Glyph transform */
        AffineTransform glyphAT = getGlyphTransform(glyphIndex);
        if (glyphAT != null){
            at.preConcatenate(glyphAT);
        }

        int idx  = glyphIndex << 1;

        gp.transform(at);
        gp.transform(AffineTransform.getTranslateInstance(visualPositions[idx], visualPositions[idx+1]));
        return gp;
    }
View Full Code Here

     * @return a Shape object that is the outline of this GlyphVector
     * at the specified coordinates.
     */
    @Override
    public Shape getOutline(float x, float y) {
        GeneralPath gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
        for (int i = 0; i < this.vector.length; i++) {
            GeneralPath outline = (GeneralPath)getGlyphOutline(i);

            /* Applying translation to actual visual bounds */
            outline.transform(AffineTransform.getTranslateInstance(x, y));
            gp.append(outline, false);
        }

        return gp;
    }
View Full Code Here

        float x0 = visualPositions[glyphIndex*2];
        float y0 = visualPositions[glyphIndex*2+1];
        float advanceX = glyph.getGlyphPointMetrics().getAdvanceX();

        GeneralPath gp = new GeneralPath();
        gp.moveTo(0, -ascent - leading);
        gp.lineTo(advanceX ,-ascent - leading);
        gp.lineTo(advanceX, descent);
        gp.lineTo(0, descent);
        gp.lineTo(0, -ascent - leading);
        gp.closePath();

        /* Applying GlyphVector font transform */
        AffineTransform at = (AffineTransform)this.transform.clone();

        /* Applying Glyph transform */
        AffineTransform glyphTransform = getGlyphTransform(glyphIndex);
        if (glyphTransform != null){
            at.concatenate(glyphTransform);
        }

        /* Applying translation to actual visual bounds */
        at.preConcatenate(AffineTransform.getTranslateInstance(x0, y0));
        gp.transform(at);
        return gp;
    }
View Full Code Here

TOP

Related Classes of com.jgraph.gaeawt.java.awt.geom.GeneralPath$Iterator

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.