Search in sources :

Example 26 with Color

use of javafx.scene.paint.Color in project JFoenix by jfoenixadmin.

the class JFXColorPickerUI method updateHSLCircleColor.

private void updateHSLCircleColor(int x, int y) {
    // transform color to HSL space
    Color color = huesCircleView.getImage().getPixelReader().getColor(x, y);
    double max = Math.max(color.getRed(), Math.max(color.getGreen(), color.getBlue())), min = Math.min(color.getRed(), Math.min(color.getGreen(), color.getBlue()));
    double hue = 0;
    if (max != min) {
        double d = max - min;
        if (max == color.getRed()) {
            hue = (color.getGreen() - color.getBlue()) / d + (color.getGreen() < color.getBlue() ? 6 : 0);
        } else if (max == color.getGreen()) {
            hue = (color.getBlue() - color.getRed()) / d + 2;
        } else if (max == color.getBlue()) {
            hue = (color.getRed() - color.getGreen()) / d + 4;
        }
        hue /= 6;
    }
    currentHue = map(hue, 0, 1, 0, 255);
    // refresh the HSL circle
    refreshHSLCircle();
}
Also used : Color(javafx.scene.paint.Color)

Example 27 with Color

use of javafx.scene.paint.Color in project JFoenix by jfoenixadmin.

the class JFXColorPickerUI method setColorAtLocation.

private void setColorAtLocation(int x, int y) {
    if (allowColorChange) {
        Color color = getColorAtLocation(x, y);
        String colorString = "rgb(" + color.getRed() * 255 + "," + color.getGreen() * 255 + "," + color.getBlue() * 255 + ");";
        colorNodes.forEach(node -> node.setStyle("-fx-background-color:" + colorString + "; -fx-fill:" + colorString + ";"));
    }
}
Also used : Color(javafx.scene.paint.Color)

Example 28 with Color

use of javafx.scene.paint.Color in project JFoenix by jfoenixadmin.

the class JFXFillTransition method interpolate.

/**
	 * {@inheritDoc}
	 */
@Override
protected void interpolate(double frac) {
    if (start == null)
        starting();
    Color newColor = start.interpolate(end, frac);
    if (Color.TRANSPARENT.equals(start))
        newColor = new Color(end.getRed(), end.getGreen(), end.getBlue(), newColor.getOpacity());
    region.get().setBackground(new Background(new BackgroundFill(newColor, radii, insets)));
}
Also used : Background(javafx.scene.layout.Background) Color(javafx.scene.paint.Color) BackgroundFill(javafx.scene.layout.BackgroundFill)

Example 29 with Color

use of javafx.scene.paint.Color in project processing by processing.

the class PGraphicsFX2D method backgroundImpl.

//  //////////////////////////////////////////////////////////////
//
//  // MATERIAL PROPERTIES
//
//
//  //public void ambient(int rgb)
//  //public void ambient(float gray)
//  //public void ambient(float x, float y, float z)
//  //protected void ambientFromCalc()
//  //public void specular(int rgb)
//  //public void specular(float gray)
//  //public void specular(float x, float y, float z)
//  //protected void specularFromCalc()
//  //public void shininess(float shine)
//  //public void emissive(int rgb)
//  //public void emissive(float gray)
//  //public void emissive(float x, float y, float z )
//  //protected void emissiveFromCalc()
//
//
//
//  //////////////////////////////////////////////////////////////
//
//  // LIGHTS
//
//
//  //public void lights()
//  //public void noLights()
//  //public void ambientLight(float red, float green, float blue)
//  //public void ambientLight(float red, float green, float blue,
//  //                         float x, float y, float z)
//  //public void directionalLight(float red, float green, float blue,
//  //                             float nx, float ny, float nz)
//  //public void pointLight(float red, float green, float blue,
//  //                       float x, float y, float z)
//  //public void spotLight(float red, float green, float blue,
//  //                      float x, float y, float z,
//  //                      float nx, float ny, float nz,
//  //                      float angle, float concentration)
//  //public void lightFalloff(float constant, float linear, float quadratic)
//  //public void lightSpecular(float x, float y, float z)
//  //protected void lightPosition(int num, float x, float y, float z)
//  //protected void lightDirection(int num, float x, float y, float z)
//////////////////////////////////////////////////////////////
// BACKGROUND
@Override
public void backgroundImpl() {
    // if pixels are modified, we don't flush them (just mark them flushed)
    // because they would be immediatelly overwritten by the background anyway
    modified = false;
    loaded = false;
    // Save drawing context (transform, fill, blend mode, etc.)
    context.save();
    // Reset transform to identity
    context.setTransform(new Affine());
    // This only takes into account cases where this is the primary surface.
    // Not sure what we do with offscreen anyway.
    context.setFill(new Color(backgroundR, backgroundG, backgroundB, backgroundA));
    context.setGlobalBlendMode(BlendMode.SRC_OVER);
    context.fillRect(0, 0, width, height);
    // Restore drawing context (transform, fill, blend mode, etc.)
    context.restore();
}
Also used : Affine(javafx.scene.transform.Affine) Color(javafx.scene.paint.Color)

Example 30 with Color

use of javafx.scene.paint.Color in project intellij-community by JetBrains.

the class Main method foo.

void foo() {
    Color color1 = new Color(0, 0.251, 0.502, 1);
    Color color2 = Color.color(0.251, 0.502, 1, 0);
    Color color3 = Color.color(0.502, 1, 0, 0.251);
    Color color4 = color(1, 0, 0.251, 0.502);
    Color color5 = color(0, 0.251, 0.502);
    Color gray1 = Color.color(0.251, 0.502, 1, 0);
    Color gray2 = Color.color(0.502, 1, 0, 0.251);
    Color gray3 = color(1, 0, 0.251, 0.502);
    Color gray4 = color(0, 0.251, 0.502);
    Color rgb1 = Color.rgb(64, 128, 255, 0);
    Color rgb2 = rgb(128, 255, 0, 0.251);
    Color rgb3 = Color.rgb(255, 0, 64, 0.502);
    Color rgb4 = rgb(0, 64, 128);
    Color grayRgb1 = Color.rgb(64, 128, 255, 0);
    Color grayRgb2 = rgb(128, 255, 0, 0.251);
    Color grayRgb3 = Color.rgb(255, 0, 64, 0.502);
    Color grayRgb4 = rgb(0, 64, 128);
    Color hsb1 = Color.hsb(219.8953, 0.749, 1, 0);
    Color hsb2 = hsb(89.8824, 1, 1, 0.251);
    Color hsb3 = Color.hsb(344.9412, 1, 1, 0.502);
    Color hsb4 = hsb(210, 1, 0.502);
    Color hsb5 = hsb(219.8953, 0.749, 1, 0);
}
Also used : Color(javafx.scene.paint.Color)

Aggregations

Color (javafx.scene.paint.Color)52 Rotate (javafx.scene.transform.Rotate)12 Random (java.util.Random)10 Group (javafx.scene.Group)10 Translate (javafx.scene.transform.Translate)10 Scene (javafx.scene.Scene)9 MouseEvent (javafx.scene.input.MouseEvent)7 FXML (javafx.fxml.FXML)6 IOException (java.io.IOException)5 List (java.util.List)5 ObservableList (javafx.collections.ObservableList)5 PerspectiveCamera (javafx.scene.PerspectiveCamera)5 KeyCode (javafx.scene.input.KeyCode)5 StackPane (javafx.scene.layout.StackPane)5 Node (javafx.scene.Node)4 TextField (javafx.scene.control.TextField)4 Background (javafx.scene.layout.Background)4 JFXRadioButton (com.jfoenix.controls.JFXRadioButton)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3