Package java.awt.geom

Examples of java.awt.geom.Area$Intersection


            loadIntegerAttribute(e,shape,"sides");
            loadNumberAttribute(e,shape,"angle");
            loadBooleanAttribute(e,shape,"star");
        }
        if(e.attrEquals("type","area")) {
            shape = new SArea(new Area());
        }
        if(e.attrEquals("type","arrow")) {
            shape = new SArrow(
                    Double.parseDouble(e.attr("startX")),
                    Double.parseDouble(e.attr("startY")),
                    Double.parseDouble(e.attr("endX")),
                    Double.parseDouble(e.attr("endY")));
            ((SArrow)shape).setHeadEnd(SArrow.HeadEnd.valueOf(e.attr("headEnd")));
        }

        if(shape == null) {
            Log.warning("warning. shape not detected. Shape type is: ",e.attr("type"));
            return null;
        }
        loadStringAttribute(e,shape,"id");
        loadStringAttribute(e,shape,"linkTarget");
        if(e.hasAttr("fillPaint")) {
            shape.setFillPaint(loadFillPaint(e, "fillPaint", zipFile));
        } else {
            shape.setFillPaint(null);
        }
        loadNumberAttribute(e,shape,"fillOpacity");
        if(e.hasAttr("strokePaint")) {
            loadFlatColorAttribute(e,shape,"strokePaint", FlatColor.class);
        } else {
            shape.setStrokePaint(null);
        }
        loadNumberAttribute(e,shape,"strokeWidth");
        loadNumberAttribute(e,shape,"translateX");
        loadNumberAttribute(e,shape,"translateY");
        loadNumberAttribute(e,shape,"anchorX");
        loadNumberAttribute(e,shape,"anchorY");
        loadNumberAttribute(e,shape,"scaleX");
        loadNumberAttribute(e,shape,"scaleY");
        loadNumberAttribute(e,shape,"rotate");
        if(e.attrEquals("type","path")) {
            SPath path = (SPath) shape;

            //handle oldstyle first
            for(Elem element : e.xpath("pathpoint")) {
                path.addPoint(new SPath.PathPoint(
                        Double.parseDouble(element.attr("x")),
                        Double.parseDouble(element.attr("y")),
                        Double.parseDouble(element.attr("cx1")),
                        Double.parseDouble(element.attr("cy1")),
                        Double.parseDouble(element.attr("cx2")),
                        Double.parseDouble(element.attr("cy2"))
                ));
            }

            //now handle the newstyle
            boolean first = true;
            for(Elem subelement : e.xpath("subpath")) {
                if(!first) path.newSubPath();
                for(Elem element : subelement.xpath("pathpoint")) {
                    path.addPoint(new SPath.PathPoint(
                            Double.parseDouble(element.attr("x")),
                            Double.parseDouble(element.attr("y")),
                            Double.parseDouble(element.attr("cx1")),
                            Double.parseDouble(element.attr("cy1")),
                            Double.parseDouble(element.attr("cx2")),
                            Double.parseDouble(element.attr("cy2"))
                    ));
                }
                if(subelement.attrEquals("closed","true")) {
                    path.close();
                }
                first = false;
            }
            if(e.attrEquals("closed","true")) {
                path.close();
            }
            path.recalcPath();
        }

        if(e.attrEquals("type","area")) {
            SArea area = (SArea) shape;
            Path2D.Double path = new Path2D.Double();
            for(Elem element : e.xpath("*")) {
                if(element.name().equals("move")) {
                    path.moveTo(
                            Double.parseDouble(element.attr("x")),
                            Double.parseDouble(element.attr("y"))
                    );
                }
                if(element.name().equals("lineto")) {
                    path.lineTo(
                            Double.parseDouble(element.attr("x")),
                            Double.parseDouble(element.attr("y"))
                    );
                }
                if(element.name().equals("curveto")) {
                    path.curveTo(
                            Double.parseDouble(element.attr("cx1")),
                            Double.parseDouble(element.attr("cy1")),
                            Double.parseDouble(element.attr("cx2")),
                            Double.parseDouble(element.attr("cy2")),
                            Double.parseDouble(element.attr("x2")),
                            Double.parseDouble(element.attr("y2"))
                    );
                }
                if(element.name().equals("close")) {
                    path.closePath();
                }
            }
            area.setArea(new Area(path));
        }

        loadProperties(e,shape);
        return shape;
    }
View Full Code Here


        Polygon poly = new Polygon();
        double[] points = toPoints();
        for(int i=0; i<points.length; i+=2) {
            poly.addPoint((int)points[i],(int)points[i+1]);
        }
        return new Area(poly);
    }
View Full Code Here

        Polygon poly = new Polygon();
        double[] points = toPoints();
        for(int i=0; i<points.length; i+=2) {
            poly.addPoint((int)points[i],(int)points[i+1]);
        }
        return new Area(transformShape(poly));
    }
View Full Code Here

        Font.drawCentered(g,"Button",Font.DEFAULT, getX(), getY(), getWidth(), getHeight(),true);
    }

    @Override
    public Area toArea() {
        return new Area();
    }
View Full Code Here

        return super.duplicate(dupe);
    }

    @Override
    public Area toArea() {
        return new Area();
    }
View Full Code Here

    }

    public void draw(GFX g) {
        double dx = image.getTranslateX();
        double dy = image.getTranslateY();
        Area a = shape.toArea();
        a.transform(AffineTransform.getTranslateInstance(-dx, -dy));
        //g.setMask(a);
        g.translate(dx,dy);
        image.draw(g);
        g.translate(-dx,-dy);
        //g.setMask(null);
View Full Code Here

        return super.duplicate(dupe);
    }

    @Override
    public Area toArea() {
        return new Area();
    }
View Full Code Here

                getX(),
                getY(),
                getWidth(),
                getHeight()
        );
        return new Area(transformShape(sh));
    }
View Full Code Here

                final SketchDocument.SketchPage page = context.getDocument().getCurrentPage();
                for(SNode node : context.getSelection().sortedItems(context.getDocument())) {
                    selection.add(node);
                }

                Area area = new Area();
                int count = 0;
                for(SNode node : selection) {
                    page.remove(node);
                    applyToArea(area, node, count);
                    count++;
View Full Code Here

        return super.duplicate(dupe);
    }

    @Override
    public Area toArea() {
        return new Area(
                transformShape(new java.awt.Rectangle.Double(
                    getX(),
                    getY(),
                    getWidth(),getHeight()
            )));
View Full Code Here

TOP

Related Classes of java.awt.geom.Area$Intersection

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.