Package nodebox.graphics

Examples of nodebox.graphics.Rect


        }
        FunctionRepository functionRepository = FunctionRepository.combine(systemRepository.getFunctionRepository(), library.getFunctionRepository());
        library.getRoot();
        NodeContext ctx = new NodeContext(library, functionRepository);
        List<?> result = ctx.renderNode(library.getRoot());
        Rect bounds = library.getBounds();
        BufferedImage img = new BufferedImage(
                (int) Math.ceil(bounds.getWidth()),
                (int) Math.ceil(bounds.getHeight()),
                BufferedImage.TYPE_INT_ARGB);
        Graphics2D g = img.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g.translate(-bounds.getX(), -bounds.getY());
        GrobVisualizer.INSTANCE.draw(g, result);
        img.flush();
        try {
            ImageIO.write(img, "png", outFile);
        } catch (IOException e) {
View Full Code Here


        py = pt.getY();
        Point op = (Point) getValue(positionName);
        ox = op.x;
        oy = op.y;

        Rect hitRect = createHitRectangle(ox, oy);
        dragging = hitRect.contains(pt);
        return dragging;
    }
View Full Code Here

        double[] xy = Geometry.coordinates(cx, cy, handleLength, oa);
        float x = (float) xy[0];
        float y = (float) xy[1];
        Path p = new Path();
        p.ellipse(cx, cy, handleLength * 2, handleLength * 2);
        Rect handleRect = createHitRectangle(x, y);
        float a = (float) Geometry.angle(cx, cy, pt.x, pt.y);
        xy = Geometry.coordinates(cx, cy, handleLength, a);
        float x1 = (float) xy[0];
        float y1 = (float) xy[1];
        Rect circleRect = createHitRectangle(x1, y1);
        if (handleRect.contains(pt))
            dragState = DragState.HANDLE;
        else if (circleRect.contains(pt)) {
            pa = a; // pressed angle
            dragState = DragState.CIRCLE;
        } else
            dragState = DragState.NONE;
        return (dragState != DragState.NONE);
View Full Code Here

        Point cp = (Point) getValue(translateName);
        double x = ox = cp.x;
        double y = oy = cp.y;

        Rect centerRect = createHitRectangle(x, y);
        Rect horRect = createHitRectangle(x + handleLength, y);
        Rect vertRect = createHitRectangle(x, y + handleLength);

        if (centerRect.contains(pt))
            dragState = DragState.CENTER;
        else if (horRect.contains(pt))
            dragState = DragState.HORIZONTAL;
        else if (vertRect.contains(pt))
            dragState = DragState.VERTICAL;

        return (dragState != DragState.NONE);
    }
View Full Code Here

        double left = ocx - owidth / 2;
        double right = ocx + owidth / 2;
        double top = ocy - oheight / 2;
        double bottom = ocy + oheight / 2;

        Rect topLeft = createHitRectangle(left, top);
        Rect topRight = createHitRectangle(right, top);
        Rect bottomLeft = createHitRectangle(left, bottom);
        Rect bottomRight = createHitRectangle(right, bottom);
        Rect center = new Rect(left, top, owidth, oheight);

        if (topLeft.contains(pt)) {
            dragState = DragState.TOP_LEFT;
        } else if (topRight.contains(pt)) {
            dragState = DragState.TOP_RIGHT;
        } else if (bottomLeft.contains(pt)) {
            dragState = DragState.BOTTOM_LEFT;
        } else if (bottomRight.contains(pt)) {
            dragState = DragState.BOTTOM_RIGHT;
        } else if (center.contains(pt)) {
            dragState = DragState.CENTER;
        } else {
            dragState = DragState.NONE;
            return false;
        }
View Full Code Here

    public boolean mousePressed(Point pt) {
        double left = -handleWidth / 2;
        double right = handleWidth / 2;
        double top = -handleHeight / 2;
        double bottom = handleHeight / 2;
        Rect topLeft = createHitRectangle(left, top);
        Rect topRight = createHitRectangle(right, top);
        Rect bottomLeft = createHitRectangle(left, bottom);
        Rect bottomRight = createHitRectangle(right, bottom);
        px = pt.getX();
        py = pt.getY();
        Point op = (Point) getValue(scaleName);
        ox = op.x;
        oy = op.y;
        if (topLeft.contains(pt))
            dragState = DragState.TOP_LEFT;
        else if (topRight.contains(pt))
            dragState = DragState.TOP_RIGHT;
        else if (bottomLeft.contains(pt))
            dragState = DragState.BOTTOM_LEFT;
        else if (bottomRight.contains(pt))
            dragState = DragState.BOTTOM_RIGHT;
        else
            dragState = DragState.NONE;
        return (dragState != DragState.NONE);
    }
View Full Code Here

public class SnapHandle extends AbstractHandle {

    @Override
    protected Rect createHitRectangle(double x, double y) {
        return new Rect(-1000, -1000, 2000, 2000);
    }
View Full Code Here

TOP

Related Classes of nodebox.graphics.Rect

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.