Package javafx.scene.paint

Examples of javafx.scene.paint.Color


    messageTypeRegEx = new SimpleStringProperty((String)in.readObject());
    double r = in.readDouble();
    double g = in.readDouble();
    double b = in.readDouble();
    double o = in.readDouble();
    color = new SimpleObjectProperty<Color>(new Color(r,g,b,o));
  }
View Full Code Here


        checkGrayColor(TestColors.TEST_COLOR_GRAY_2);
        checkGrayColor(TestColors.TEST_COLOR_GRAY_3);
    }

    private void checkGrayColor(final ColorItem colorItem) {
        final Color color = colorItem.get();
        final GrayColor wc = (GrayColor) ResourceBuilders.COLOR_BUILDER.getParam(colorItem);

        // compareRoundedValues(color.getRed(), convert255To1(wc.hex().substring(0, 2)));
        // compareRoundedValues(color.getGreen(), convert255To1(wc.hex().substring(2, 4)));
        // compareRoundedValues(color.getBlue(), convert255To1(wc.hex().substring(4, 6)));

        assertEquals(color.getOpacity(), wc.opacity(), 0.1);

    }
View Full Code Here

        checkHsbColor(TestColors.TEST_COLOR_HSB_2);
        checkHsbColor(TestColors.TEST_COLOR_HSB_3);
    }

    private void checkHsbColor(final ColorItem colorItem) {
        final Color color = colorItem.get();
        final HSBColor wc = (HSBColor) ResourceBuilders.COLOR_BUILDER.getParam(colorItem);

        assertEquals(color.getHue(), wc.hue(), 1.0);
        assertEquals(color.getSaturation(), wc.saturation(), 0.000001);
        assertEquals(color.getBrightness(), wc.brightness(), 0.000001);

        assertEquals(color.getOpacity(), wc.opacity(), 0.1);
    }
View Full Code Here

        checkWebColor(TestColors.TEST_COLOR_WEB_2);
        checkWebColor(TestColors.TEST_COLOR_WEB_3);
    }

    private void checkWebColor(final ColorItem colorItem) {
        final Color color = colorItem.get();
        final WebColor wc = (WebColor) ResourceBuilders.COLOR_BUILDER.getParam(colorItem);

        assertEquals(color.getRed(), convertHexToDouble(wc.hex().substring(0, 2)), 0.000001);
        assertEquals(color.getGreen(), convertHexToDouble(wc.hex().substring(2, 4)), 0.000001);
        assertEquals(color.getBlue(), convertHexToDouble(wc.hex().substring(4, 6)), 0.000001);

        assertEquals(color.getOpacity(), wc.opacity(), 0.1);

    }
View Full Code Here

        checkRgb01Color(TestColors.TEST_COLOR_RGB01_2);
        checkRgb01Color(TestColors.TEST_COLOR_RGB01_3);
    }

    private void checkRgb01Color(final ColorItem colorItem) {
        final Color color = colorItem.get();
        final RGB01Color wc = (RGB01Color) ResourceBuilders.COLOR_BUILDER.getParam(colorItem);

        assertEquals(color.getRed(), wc.red(), 0.000001);
        assertEquals(color.getGreen(), wc.green(), 0.000001);
        assertEquals(color.getBlue(), wc.blue(), 0.000001);

        assertEquals(color.getOpacity(), wc.opacity(), 0.1);
    }
View Full Code Here

        checkRgb255Color(TestColors.TEST_COLOR_RGB255_2);
        checkRgb255Color(TestColors.TEST_COLOR_RGB255_3);
    }

    private void checkRgb255Color(final ColorItem colorItem) {
        final Color color = colorItem.get();
        final RGB255Color wc = (RGB255Color) ResourceBuilders.COLOR_BUILDER.getParam(colorItem);

        assertEquals(color.getRed(), convert255To1(wc.red()), 0.000001);
        assertEquals(color.getGreen(), convert255To1(wc.green()), 0.000001);
        assertEquals(color.getBlue(), convert255To1(wc.blue()), 0.000001);

        assertEquals(color.getOpacity(), wc.opacity(), 0.1);
    }
View Full Code Here

        }
        return false;
    }

    protected void updateText() {
        Color color = ((WebColorField) control).getValue();
        if (color == null) color = Color.BLACK;
        getTextField().setText(getWebColor(color));
    }
View Full Code Here

        if (color == null) color = Color.BLACK;
        getTextField().setText(getWebColor(color));
    }

    protected void updateValue() {
        Color value = ((WebColorField) control).getValue();
        String text = getTextField().getText() == null ? "" : getTextField().getText().trim().toUpperCase();
        if (text.matches("#[A-F0-9]{6}")) {
            try {
                Color newValue = Color.web(text);
                if (!newValue.equals(value)) {
                    ((WebColorField) control).setValue(newValue);
                }
            } catch (java.lang.IllegalArgumentException ex) {
                System.out.println("Failed to parse ["+text+"]");
            }
View Full Code Here

            }
        });
        derivedResultLabel.textProperty().bind(new StringBinding() {
            { bind(derivationSlider.valueProperty(),baseColorPicker.colorProperty()); }
            @Override protected String computeValue() {
                Color base = baseColorPicker.getColor();
                double derivation = derivationSlider.getValue();
                Color result = Utils.deriveColor(base, derivation/100);
                return getColorString(result);
            }
        });
        // BACKWARD
        reverseResultColor = new Region();
View Full Code Here

        baseColorPicker.colorProperty().addListener(updateReverse);
        desiredColorPicker.colorProperty().addListener(updateReverse);
    }   
   
    private void updateReverse() {
        Color desiredColor = desiredColorPicker.getColor();
        final Color base = baseColorPicker.getColor();
//                System.out.println("base = " + base);
        double desiredBrightness = desiredColor.getBrightness();
//                System.out.println("desiredBrightness = " + desiredBrightness);
        double desiredSaturation = desiredColor.getSaturation();
//                System.out.println("desiredSaturation = " + desiredSaturation);
        double derivation = 0, max = 1, min = -1;
        Color derivedColor = Color.WHITE;
        for(int i=0; i< 100;i++){
//                    System.out.println("---------- "+i+" ----------------");
//                    System.out.println("derivation = " + derivation);
//                    System.out.println("max = " + max);
//                    System.out.println("min = " + min);
            derivedColor = Utils.deriveColor(base, derivation);
            double derivedBrightness = derivedColor.getBrightness();
//                    System.out.println("derivedBrightness = " + derivedBrightness);
            double derivedSaturation = derivedColor.getSaturation();
//                    System.out.println("derivedSaturation = " + derivedSaturation);
            double saturationDifference = Math.abs(derivedSaturation-desiredSaturation);
//                    System.out.println("saturationDifference = " + saturationDifference);
            double difference = Math.abs(derivedBrightness-desiredBrightness);
//                    System.out.println("brightness difference = " + difference);
View Full Code Here

TOP

Related Classes of javafx.scene.paint.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.