Package nodebox.graphics

Examples of nodebox.graphics.Path


        // original angle
        oa = (Double) getValue(angleName);
        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];
View Full Code Here


    public void draw(GraphicsContext ctx) {
        Point cp = (Point) getValue(translateName);
        double x = cp.x;
        double y = cp.y;
        ctx.rectmode(GraphicsContext.RectMode.CENTER);
        Path p = new Path();
        p.setFillColor(HANDLE_COLOR);
        ctx.stroke(HANDLE_COLOR);
        p.setStrokeColor(null);
        ctx.nofill();
        drawDot(ctx, x, y);

        if (dragState == DragState.NONE) {
            // Horizontal and vertical direction lines.
            ctx.line(x, y, x + handleLength, y);
            ctx.line(x, y, x, y + handleLength);

            // Vertical arrow
            p.moveto(x, y + handleLength + 3);
            p.lineto(x - 5, y + handleLength - 3);
            p.lineto(x + 5, y + handleLength - 3);

            // Horizontal arrow
            p.moveto(x + handleLength + 3, y);
            p.lineto(x + handleLength - 3, y - 5);
            p.lineto(x + handleLength - 3, y + 5);
        } else if (dragState == DragState.CENTER) {
            ctx.line(px, py, x, y);
            drawDot(ctx, x, y);
        } else if (dragState == DragState.HORIZONTAL) {
            double x0, x1;
            ctx.line(px - handleLength, y, x + handleLength, y);
            if (x + handleLength > px - handleLength) {
                // arrow points right
                x0 = x + handleLength + 3;
                x1 = x + handleLength - 3;
            } else {
                // arrow points left
                x0 = x + handleLength - 3;
                x1 = x + handleLength + 3;
            }
            p.moveto(x0, y);
            p.lineto(x1, y - 5);
            p.lineto(x1, y + 5);
        } else if (dragState == DragState.VERTICAL) {
            double y0, y1;
            ctx.line(x, py - handleLength, x, y + handleLength);
            if (y + handleLength > py - handleLength) {
                // arrow points down
                y0 = y + handleLength + 3;
                y1 = y + handleLength - 3;
            } else {
                // arrow points up
                y0 = y + handleLength - 3;
                y1 = y + handleLength + 3;
            }
            p.moveto(x, y0);
            p.lineto(x - 5, y1);
            p.lineto(x + 5, y1);
        }
        ctx.nostroke();
        ctx.draw(p);
    }
View Full Code Here

        double height = (Double) getValue(heightName);
        double left = cx - width / 2;
        double right = cx + width / 2;
        double top = cy - height / 2;
        double bottom = cy + height / 2;
        Path cornerPath = new Path();
        cornerPath.setFillColor(HANDLE_COLOR);
        cornerPath.setStrokeWidth(0);
        drawDot(cornerPath, left, top);
        drawDot(cornerPath, right, top);
        drawDot(cornerPath, right, bottom);
        drawDot(cornerPath, left, bottom);
        drawDot(cornerPath, cx, cy);
        ctx.draw(cornerPath);
        Path strokePath = new Path();
        strokePath.setFillColor(null);
        strokePath.setStrokeColor(HANDLE_COLOR);
        strokePath.rect(cx, cy, width, height);
        ctx.draw(strokePath);
    }
View Full Code Here

        double snapX = pos.x;
        double snapY = pos.y;
        double distance = (Double) getValue("distance");
        ctx.stroke(0.4, 0.4, 0.4, 0.5);
        ctx.strokewidth(1.0);
        Path p = new Path();
        for (int i = -100; i < 100; i++) {
            double x = -snapX + (i * distance);
            double y = -snapY + (i * distance);
            p.line(x, -1000, x, 1000);
            p.line(-1000, y, 1000, y);
        }
        ctx.drawpath(p);
    }
View Full Code Here

TOP

Related Classes of nodebox.graphics.Path

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.