本文整理了Java中javafx.scene.paint.Color.getBlue()
方法的一些代码示例,展示了Color.getBlue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Color.getBlue()
方法的具体详情如下:
包路径:javafx.scene.paint.Color
类名称:Color
方法名:getBlue
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
public static String colorToHex(Color c) {
if (c != null) {
return String.format((Locale) null, "#%02x%02x%02x",
Math.round(c.getRed() * 255),
Math.round(c.getGreen() * 255),
Math.round(c.getBlue() * 255)).toUpperCase();
} else {
return null;
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
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()));
double 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();
}
代码示例来源:origin: jfoenixadmin/JFoenix
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 + ");";
for (Node node : colorNodes)
node.setStyle("-fx-background-color:" + colorString + "; -fx-fill:" + colorString+";");
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
void createOverlay() {
if (overlayRect == null) {
overlayRect = new OverLayRipple();
overlayRect.setClip(getMask());
getChildren().add(0, overlayRect);
if (ripplerFill.get() instanceof Color) {
overlayRect.setFill(new Color(((Color) ripplerFill.get()).getRed(),
((Color) ripplerFill.get()).getGreen(),
((Color) ripplerFill.get()).getBlue(),
0.2));
}else{
overlayRect.setFill(Color.TRANSPARENT);
}
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
public void moveToColor(Color color) {
allowColorChange = false;
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;
double l = (max + min) / 2;
s = l > 0.5 ? d / (2 - max - min) : 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;
代码示例来源:origin: jfoenixadmin/JFoenix
/**
* {@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)));
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
Color circleColor = new Color(((Color) ripplerFill.get()).getRed(),
((Color) ripplerFill.get()).getGreen(),
((Color) ripplerFill.get()).getBlue(),
0.3);
setStroke(circleColor);
代码示例来源:origin: jfoenixadmin/JFoenix
(int) (newColor.getRed() * 255),
(int) (newColor.getGreen() * 255),
(int) (newColor.getBlue() * 255));
String rgb = String.format("rgba(%d, %d, %d, 1)",
(int) (newColor.getRed() * 255),
(int) (newColor.getGreen() * 255),
(int) (newColor.getBlue() * 255));
String hsb = String.format("hsl(%d, %d%%, %d%%)",
(int) (newColor.getHue()),
代码示例来源:origin: com.jfoenix/jfoenix
public static String colorToHex(Color c) {
if (c != null) {
return String.format((Locale) null, "#%02x%02x%02x",
Math.round(c.getRed() * 255),
Math.round(c.getGreen() * 255),
Math.round(c.getBlue() * 255)).toUpperCase();
} else {
return null;
}
}
代码示例来源:origin: org.copper-engine/copper-monitoring-client
public static String toHex(Color color) {
int red = (int) (Math.round(color.getRed() * 255));
int green = (int) (Math.round(color.getGreen() * 255));
int blue = (int) (Math.round(color.getBlue() * 255));
return String.format("#%02X%02X%02X", red, green, blue);
}
代码示例来源:origin: com.cedarsoft.commons/javafx
@Nonnull
public static String toRGB(@Nonnull Color color) {
int r = (int) (color.getRed() * 255);
int g = (int) (color.getGreen() * 255);
int b = (int) (color.getBlue() * 255);
return "rgb(" + r + ", " + g + ", " + b + ")";
}
代码示例来源:origin: com.aquafx-project/aquafx
private String colorToRGBA(Color color) {
// Older version didn't care about opacity
// return String.format((Locale) null, "#%02x%02x%02x",
// Math.round(color.getRed() * 255),
// Math.round(color.getGreen() * 255),
// Math.round(color.getBlue() * 255));
return String.format((Locale) null, "rgba(%d, %d, %d, %f)", (int) Math.round(color.getRed() * 255),
(int) Math.round(color.getGreen() * 255), (int) Math.round(color.getBlue() * 255), color.getOpacity());
}
代码示例来源:origin: com.github.almasb/fxgl-entity
public void set(Color color) {
r = (byte) (255 * color.getRed());
g = (byte) (255 * color.getGreen());
b = (byte) (255 * color.getBlue());
a = (byte) 255;
}
代码示例来源:origin: com.github.almasb/fxgl-physics
public void set(Color color) {
r = (byte) (255 * color.getRed());
g = (byte) (255 * color.getGreen());
b = (byte) (255 * color.getBlue());
a = (byte) 255;
}
代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX
private Color calculateContrastColor(Color color) {
double r = color.getRed();
double g = color.getGreen();
double b = color.getBlue();
double gray = (r + g + b);
if (gray > 0.7) {
return Color.BLACK;
} else {
return Color.WHITE;
}
}
代码示例来源:origin: com.cedarsoft.commons/javafx
@Nonnull
public static String toRGBA(@Nonnull Color color) {
int r = (int) (color.getRed() * 255);
int g = (int) (color.getGreen() * 255);
int b = (int) (color.getBlue() * 255);
return "rgb(" + r + ", " + g + ", " + b + ", " + color.getOpacity() + ")";
}
代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg
static void randomColor(PropertyStorage storage) {
Color c = colors[(int) (Math.random() * colors.length)];
storage.set("material:color",
"" + c.getRed()
+ " " + c.getGreen()
+ " " + c.getBlue());
}
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-visualizers
public static Color toTransparentColor(Color opaqueColor, double opacity)
{
double red = opaqueColor.getRed();
double green = opaqueColor.getGreen();
double blue = opaqueColor.getBlue();
return new Color(red, green, blue, opacity);
}
代码示例来源:origin: com.jfoenix/jfoenix
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 + ");";
for (Node node : colorNodes)
node.setStyle("-fx-background-color:" + colorString + "; -fx-fill:" + colorString+";");
}
}
代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg
public CSG color(Color c) {
CSG result = this.clone();
storage.set("material:color",
"" + c.getRed()
+ " " + c.getGreen()
+ " " + c.getBlue());
return result;
}
内容来源于网络,如有侵权,请联系作者删除!