Package java.awt.geom

Examples of java.awt.geom.Area


        Point2D.Double center = new Point2D.Double((double) width / 2,
                (double) height / 2);
        double fixedAngle = 2.0 * Math.PI / barsCount;
        double maxY = 0.0d;
        for (double i = 0.0; i < barsCount; i++) {
            Area primitive = buildPrimitive();

            AffineTransform toCenter = AffineTransform.getTranslateInstance(
                    center.getX(), center.getY());
            AffineTransform toBorder = AffineTransform.getTranslateInstance(
                    35.0, -6.0);
            AffineTransform toCircle = AffineTransform.getRotateInstance(-i
                    * fixedAngle, center.getX(), center.getY());

            AffineTransform toWheel = new AffineTransform();
            toWheel.concatenate(toCenter);
            toWheel.concatenate(toBorder);

            primitive.transform(toWheel);
            primitive.transform(toCircle);

            areas[(int) i] = primitive;

            Rectangle2D bounds = primitive.getBounds2D();
            if (bounds.getMaxY() > maxY) {
                maxY = bounds.getMaxY();
            }
        }

View Full Code Here


        Rectangle2D.Double body = new Rectangle2D.Double(6, 0, 30, 12);

        Ellipse2D.Double head = new Ellipse2D.Double(0, 0, 12, 12);
        Ellipse2D.Double tail = new Ellipse2D.Double(30, 0, 12, 12);

        Area tick = new Area(body);
        tick.add(new Area(head));
        tick.add(new Area(tail));

        return tick;
    }
View Full Code Here

            out.start("path");
            out.attr("transform","translate("+ shape.getTranslateX()+","+ shape.getTranslateY()+")");
            //the vector data
            StringBuffer data = new StringBuffer();
            int count = 0;
            Area area = shape.toArea();
            PathIterator it = area.getPathIterator(new AffineTransform());
            while(!it.isDone()) {
                double[] coords = new double[6];
                int n = it.currentSegment(coords);
                if(n == PathIterator.SEG_MOVETO) {
                    data.append(" M "+coords[0]+" "+coords[1]);
View Full Code Here

                out.end();
            }
        }
        if(shape instanceof SArea) {
            SArea area = (SArea) shape;
            Area jarea = area.toArea();
            PathIterator it = jarea.getPathIterator(null);
            while(!it.isDone()) {
                double[] coords = new double[6];
                int n = it.currentSegment(coords);
                if(n == PathIterator.SEG_MOVETO) {
                    out.start("move","x",""+coords[0],"y",""+coords[1]).end();
View Full Code Here

                    if(shape instanceof SPath) out.println("\n//path");
                    if(shape instanceof SArea) out.println("\n//area");
                    if(shape instanceof SPoly) out.println("\n//polygon");
                    if(shape instanceof NGon) out.println("\n//n-gon");

                    Area area = shape.toArea();
                    Rectangle2D bounds = area.getBounds2D();
                    double dx = bounds.getX();
                    double dy = bounds.getY();
                    out.println("ctx.translate("+dx+","+dy+");");
                    out.println("ctx.beginPath()");

                    PathIterator it = area.getPathIterator(null);
                    while(!it.isDone()) {
                        double[] coords = new double[6];
                        int n = it.currentSegment(coords);
                        if(n == PathIterator.SEG_MOVETO) {
                            out.println("ctx.moveTo("+(coords[0]-dx)+","+(coords[1]-dy)+");");
View Full Code Here

                gp.lineTo(boxes[5].x, boxes[5].y);
                gp.lineTo(boxes[6].x, boxes[6].y);
                gp.lineTo(boxes[7].x, boxes[7].y);
                gp.closePath();
            }
            areas[nAreas++] = new Area(gp);
        }

        mergeAreas(shape, areas, nAreas);
    }
View Full Code Here

                gp.lineTo(boxes[5].x, boxes[5].y);
                gp.lineTo(boxes[6].x, boxes[6].y);
                gp.lineTo(boxes[7].x, boxes[7].y);
                gp.closePath();
            }
            areas[nAreas++] = new Area(gp);
        }

        mergeAreas(shape, areas, nAreas);
    }
View Full Code Here

    /**
     * Returns the area painted by this shape painter.
     */
    public Shape getPaintedArea(){
        if (painters != null) {
            Area paintedArea = new Area();
            for (int i=0; i < count; ++i) {
                Shape s = painters[i].getPaintedArea();
                if (s != null) {
                    paintedArea.add(new Area(s));
                }
            }
            return paintedArea;
        } else {
            return null;
View Full Code Here

     */
    public boolean shouldBeClipped(Shape clip, Shape s) {
        if (clip == null || s == null) {
            return false;
        }
        Area as = new Area(s);
        Area imclip = new Area(clip);
        imclip.intersect(as);
        return !imclip.equals(as);
    }
View Full Code Here

        if (s != null) {
            s = transform.createTransformedShape(s);
        }

        if (clip != null) {
            Area newClip = new Area(clip);
            newClip.intersect(new Area(s));
            clip = new GeneralPath(newClip);
        } else {
            clip = s;
        }
    }
View Full Code Here

TOP

Related Classes of java.awt.geom.Area

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.