Example usage for javafx.scene.paint Color hsb

List of usage examples for javafx.scene.paint Color hsb

Introduction

In this page you can find the example usage for javafx.scene.paint Color hsb.

Prototype

public static Color hsb(double hue, double saturation, double brightness) 

Source Link

Document

Creates an opaque Color based on the specified values in the HSB color model.

Usage

From source file:nars.rl.util.ThreeDView.java

public void addPoint(Object o, double radius, double x, double y, double z) {

    Term t = (Term) o;/*from   ww w.  j a v a2  s . com*/

    final PhongMaterial mat = new PhongMaterial();
    Color c = Color.hsb(255.0 * Video.hashFloat(o.toString().hashCode()), 0.75f, 0.85f);
    mat.setDiffuseColor(c);
    System.out.println(o.getClass());
    Sphere point = new Sphere(radius / t.complexity());
    point.setOpacity(0.85);
    point.setTranslateX(x);
    point.setTranslateY(y);
    point.setTranslateZ(z);
    point.setMaterial(mat);

    space.getChildren().add(point);

    Text text = new Text(o.toString());
    text.setFill(c);
    text.setFontSmoothingType(FontSmoothingType.LCD);
    text.setSmooth(true);
    text.setTextAlignment(TextAlignment.CENTER);
    text.setFont(font);
    /*
    text.setScaleX(0.05);
    text.setScaleY(0.05);
    text.setScaleZ(0.05);
    */
    text.setTranslateX(x);
    text.setTranslateY(y);
    text.setTranslateZ(z);
    space.getChildren().add(text);

}

From source file:org.nmrfx.processor.gui.spectra.DrawSpectrum.java

static void setColorGradient(final int nLevels, final boolean refresh, final Color color1, final Color color2) {
    if (refresh || (gradColors.length != nLevels)) {
        double hue1 = color1.getHue();
        double brightness1 = color1.getBrightness();
        double saturation1 = color1.getSaturation();
        double hue2 = color2.getHue();
        double brightness2 = color2.getBrightness();
        double saturation2 = color2.getSaturation();
        gradColors = new Color[nLevels];
        for (int iColor = 0; iColor < nLevels; iColor++) {
            double f = ((double) iColor) / (nLevels - 1);
            double h = hue1 + (hue2 - hue1) * f;
            double s = saturation1 + (saturation2 - saturation1) * f;
            double b = brightness1 + (brightness2 - brightness1) * f;
            gradColors[iColor] = Color.hsb(h, s, b);
        }/*from   w  w w.j  a va2 s  .  c  o m*/
    }
}