Package org.joshy.gfx.node

Examples of org.joshy.gfx.node.Bounds


    public Bounds getEffectBounds() {
        if(getShadow() == null) {
            return getBounds();
        }
        Bounds bounds = getBounds();
        int rad = shadow.getBlurRadius();
        double xoff = shadow.getXOffset();
        double yoff = shadow.getYOffset();
        Bounds shadowBounds = new Bounds(bounds.getX()+xoff-rad,bounds.getY()+yoff-rad,bounds.getWidth()+xoff+rad,bounds.getHeight()+yoff+rad);
        Bounds union = bounds.union(shadowBounds);
        return union;
    }
View Full Code Here


        return union;
    }
    protected void regenShadow(GFX g) {
        //setup
        int blurRadius = shadow.getBlurRadius()*2;
        Bounds b = getBounds();
        oldWidth = b.getWidth();
        oldHeight = b.getHeight();
        buf = g.createBuffer(
                (int)b.getWidth()+blurRadius*2,
                (int)b.getHeight()+blurRadius*2);

        //draw shape with shadow color
        GFX g2 = buf.getGFX();

        //fill shape with black
        g2.setPaint(FlatColor.BLACK);
        g2.translate(blurRadius,blurRadius);
        g2.translate(-b.getX(),-b.getY());
        initPaint(g2);
        fillShape(g2);
        drawShape(g2);
        g2.translate(b.getX(),b.getY());
        //blur
        buf.apply(new BlurEffect(blurRadius));
        g2.translate(-blurRadius,-blurRadius);
        //use blur as alpha mask to draw in the real color
        buf.apply(new WipeColorEffect(shadow.getColor()));
View Full Code Here

    @Override
    public Bounds getBounds() {
        if(path2d != null) {
            Rectangle bds = path2d.getBounds();
            return new Bounds(
                    bds.getX(),
                    bds.getY(),
                    bds.getWidth(),
                    bds.getHeight());
        }
        return new Bounds(0,0,100,100);
    }
View Full Code Here

            Shape sh = af.createTransformedShape(path2d);
            Rectangle2D bds = sh.getBounds2D();
            return Util.toBounds(bds);

        }
        return new Bounds(0,0,100,100);
    }
View Full Code Here

    public SketchCanvas(VectorDocContext context) {
        this.context = context;
        document = new SketchDocument();
        selection = new Selection(context);
        maxExtent = new Bounds(0,0,0,0);
    }
View Full Code Here

        maxExtent = new Bounds(0,0,0,0);
    }

    @Override
    public Bounds getVisualBounds() {
        return new Bounds(
                getTranslateX()
                ,getTranslateY()
                ,document.getWidth()*getScale()
                ,document.getHeight()*getScale()
        );
View Full Code Here

                (end.getY()-start.getY())*position + start.getY()
        );
    }

    public static Bounds toBounds(Rectangle2D bds) {
        return new Bounds(
                bds.getX(),
                bds.getY(),
                bds.getWidth(),
                bds.getHeight());
    }
View Full Code Here

        );
    }

    @Override
    public Bounds getInputBounds() {
        return new Bounds(
                getTranslateX()
                ,getTranslateY()
                ,getWidth()
                ,getHeight()
        );
View Full Code Here

    @Override
    public void doSkins() {
    }

    private Bounds calcFinalBounds() {
        Bounds maxExtent = getMaxExtent();
        Bounds docbounds = new Bounds(0,0,document.getWidth(),document.getHeight());
        Bounds finalBounds = maxExtent.union(docbounds);
        double extra = 500;
        finalBounds = new Bounds(
                finalBounds.getX()-extra,
                finalBounds.getY()-extra,
                finalBounds.getWidth()+extra*2,
                finalBounds.getHeight()+extra*2
                );
        offsetX = finalBounds.getX()*getScale();
        offsetY = finalBounds.getY()*getScale();
        double nvx = -(offsetX+panX);
        double nvy = -(offsetY+panY);
        scrollPane.getHorizontalScrollBar().setValue(nvx);
        scrollPane.getVerticalScrollBar().setValue(nvy);
        return finalBounds;
View Full Code Here

        scrollPane.getVerticalScrollBar().setValue(nvy);
        return finalBounds;
    }

    public double getFullWidth(double width, double height) {
        Bounds finalBounds = calcFinalBounds();
        return Math.max(finalBounds.getWidth()*getScale(),width);
    }
View Full Code Here

TOP

Related Classes of org.joshy.gfx.node.Bounds

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.