Package nodebox.graphics

Examples of nodebox.graphics.Color


        public void setDragPoint(Point dragPoint) {
            this.dragPoint = dragPoint;
            repaint();
            int x = dragPoint.x - point.x;
            int y = dragPoint.y - point.y;
            setColor(new Color(colorFromPoint(x, y)));
        }
View Full Code Here


        AffineTransform t = g.getTransform();
        int x = 0;
        int y = 0;

        for (Object o : objects) {
            Color c = (Color) o;
            drawColor(g, c, x, y);
            x += COLOR_TOTAL_SIZE;
            if (x > MAX_WIDTH) {
                x = 0;
                y += COLOR_TOTAL_SIZE;
View Full Code Here

        assertConversion(Port.TYPE_STRING, Port.TYPE_INT, "42", 42L);
        assertConversion(Port.TYPE_STRING, Port.TYPE_FLOAT, "42", 42.0);
        assertConversion(Port.TYPE_STRING, Port.TYPE_STRING, "hello", "hello");
        assertConversion(Port.TYPE_STRING, Port.TYPE_BOOLEAN, "true", true);
        assertConversion(Port.TYPE_STRING, Port.TYPE_BOOLEAN, "not-a-boolean", false);
        assertConversion(Port.TYPE_STRING, Port.TYPE_COLOR, "#ff0000ff", new Color(1, 0, 0));
        assertConversion(Port.TYPE_STRING, Port.TYPE_POINT, "4,2", new Point(4, 2));

        assertConversion(Port.TYPE_BOOLEAN, Port.TYPE_INT, true, 1L);
        assertConversion(Port.TYPE_BOOLEAN, Port.TYPE_INT, false, 0L);
        assertConversion(Port.TYPE_BOOLEAN, Port.TYPE_FLOAT, true, 1.0);
        assertConversion(Port.TYPE_BOOLEAN, Port.TYPE_STRING, true, "true");
        assertConversion(Port.TYPE_BOOLEAN, Port.TYPE_STRING, false, "false");
        assertConversion(Port.TYPE_BOOLEAN, Port.TYPE_BOOLEAN, false, false);
        assertConversion(Port.TYPE_BOOLEAN, Port.TYPE_COLOR, true, Color.WHITE);
        assertConversion(Port.TYPE_BOOLEAN, Port.TYPE_COLOR, false, Color.BLACK);

        assertConversion(Port.TYPE_COLOR, Port.TYPE_STRING, new Color(0, 1, 0), "#00ff00ff");
        assertConversion(Port.TYPE_COLOR, Port.TYPE_COLOR, Color.WHITE, Color.WHITE);

        assertConversion(Port.TYPE_POINT, Port.TYPE_STRING, new Point(4, 2), "4.00,2.00");
        assertConversion(Port.TYPE_POINT, Port.TYPE_POINT, new Point(4, 2), new Point(4, 2));
    }
View Full Code Here

        return color;
    }

    public static Color gray(double gray, double alpha, double range) {
        range = Math.max(range, 1);
        return new Color(gray / range, gray / range, gray / range, alpha / range);
    }
View Full Code Here

        return new Color(gray / range, gray / range, gray / range, alpha / range);
    }

    public static Color rgb(double red, double green, double blue, double alpha, double range) {
        range = Math.max(range, 1);
        return new Color(red / range, green / range, blue / range, alpha / range);
    }
View Full Code Here

        return new Color(red / range, green / range, blue / range, alpha / range);
    }

    public static Color hsb(double hue, double saturation, double brightness, double alpha, double range) {
        range = Math.max(range, 1);
        return new Color(hue / range, saturation / range, brightness / range, alpha / range, Color.Mode.HSB);
    }
View Full Code Here

TOP

Related Classes of nodebox.graphics.Color

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.