本文整理了Java中javafx.scene.paint.Color.color()
方法的一些代码示例,展示了Color.color()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Color.color()
方法的具体详情如下:
包路径:javafx.scene.paint.Color
类名称:Color
方法名:color
暂无
代码示例来源:origin: org.fxmisc.richtext/richtextfx
@Override
public Color decode(DataInputStream is) throws IOException {
return Color.color(
is.readDouble(),
is.readDouble(),
is.readDouble(),
is.readDouble());
}
代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg
private Color readColor(String line) {
String[] split = line.trim().split(" +");
float red = Float.parseFloat(split[0]);
float green = Float.parseFloat(split[1]);
float blue = Float.parseFloat(split[2]);
return Color.color(red, green, blue);
}
代码示例来源:origin: com.github.almasb/fxgl-base
@Override
public void onUpdate(double tpf) {
double frequency = 1.7;
t += tpf * frequency;
particleSystem.onUpdate(tpf);
Color color = Color.color(1, 1, 1, noise1D(t));
titleColor.set(color);
}
代码示例来源:origin: com.github.almasb/fxgl-core
public static Color randomColor() {
return Color.color(random(), random(), random());
}
代码示例来源:origin: com.github.almasb/fxgl-base
public static Color randomColor() {
return Color.color(random(), random(), random());
}
代码示例来源:origin: org.jrebirth.af/core
/**
* Build a RGB color (0.0-1.0).
*
* @param rColor the rgb color enum
*
* @return the javafx color
*/
private Color buildRGB01Color(final RGB01Color rColor) {
Color color = null;
if (rColor.opacity() >= 1.0) {
color = Color.color(rColor.red(), rColor.green(), rColor.blue());
} else {
color = Color.color(rColor.red(), rColor.green(), rColor.blue(), rColor.opacity());
}
return color;
}
代码示例来源:origin: com.aquafx-project/aquafx
@Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
List<BackgroundFill> list = new ArrayList<>();
// the animated fill
Stop[] stops = new Stop[] { new Stop(0f, Color.color(
(endColor1val.getRed() - startColor1val.getRed()) * newValue.doubleValue() + startColor1val.getRed(),
(endColor1val.getGreen() - startColor1val.getGreen()) * newValue.doubleValue() + startColor1val.getGreen(),
(endColor1val.getBlue() - startColor1val.getBlue()) * newValue.doubleValue() + startColor1val.getBlue())), new Stop(0.5f, Color.color(
(endColor2val.getRed() - startColor2val.getRed()) * newValue.doubleValue() + startColor2val.getRed(),
(endColor2val.getGreen() - startColor2val.getGreen()) * newValue.doubleValue() + startColor2val.getGreen(),
(endColor2val.getBlue() - startColor2val.getBlue()) * newValue.doubleValue() + startColor2val.getBlue())), new Stop(0.51f, Color.color(
(endColor3val.getRed() - startColor3val.getRed()) * newValue.doubleValue() + startColor3val.getRed(),
(endColor3val.getGreen() - startColor3val.getGreen()) * newValue.doubleValue() + startColor3val.getGreen(),
(endColor3val.getBlue() - startColor3val.getBlue()) * newValue.doubleValue() + startColor3val.getBlue())), new Stop(1f, Color.color(
(endColor4val.getRed() - startColor4val.getRed()) * newValue.doubleValue() + startColor4val.getRed(),
(endColor4val.getGreen() - startColor4val.getGreen()) * newValue.doubleValue() + startColor4val.getGreen(),
(endColor4val.getBlue() - startColor4val.getBlue()) * newValue.doubleValue() + startColor4val.getBlue())) };
LinearGradient gradient = new LinearGradient(0.0, 0.0, 0.0, 1.0, true, CycleMethod.NO_CYCLE, stops);
BackgroundFill backkgroudFill = new BackgroundFill(gradient, new CornerRadii(4.0), new Insets(0));
list.add(backkgroudFill);
getSkinnable().setBackground(new Background(list.get(0)));
}
代码示例来源:origin: com.github.almasb/fxgl-physics
public void drawTree(DebugDraw argDraw, int node, int spot, int height) {
AABB a = m_aabb[node];
a.getVertices(drawVecs);
Color color = Color.color(1, (height - spot) * 1f / height, (height - spot) * 1f / height);
argDraw.drawPolygon(drawVecs, 4, color);
argDraw.getViewportTranform().getWorldToScreen(a.upperBound, textVec);
argDraw.drawString(textVec.x, textVec.y, node + "-" + (spot + 1) + "/" + height, color);
int c1 = m_child1[node];
int c2 = m_child2[node];
if (c1 != NULL_NODE) {
drawTree(argDraw, c1, spot + 1, height);
}
if (c2 != NULL_NODE) {
drawTree(argDraw, c2, spot + 1, height);
}
}
}
代码示例来源:origin: com.github.almasb/fxgl-physics
public void drawTree(DebugDraw argDraw, DynamicTreeNode node, int spot, int height) {
node.aabb.getVertices(drawVecs);
Color color = Color.color(1, (height - spot) * 1f / height, (height - spot) * 1f / height);
argDraw.drawPolygon(drawVecs, 4, color);
argDraw.getViewportTranform().getWorldToScreen(node.aabb.upperBound, textVec);
argDraw.drawString(textVec.x, textVec.y, node.id + "-" + (spot + 1) + "/" + height, color);
if (node.child1 != null) {
drawTree(argDraw, node.child1, spot + 1, height);
}
if (node.child2 != null) {
drawTree(argDraw, node.child2, spot + 1, height);
}
}
}
代码示例来源:origin: com.github.almasb/fxgl-base
MenuButton(String stringKey) {
btn = new FXGLButton();
btn.setAlignment(Pos.CENTER_LEFT);
btn.setStyle("-fx-background-color: transparent");
btn.textProperty().bind(localizedStringProperty(stringKey));
p.setMouseTransparent(true);
Paint g = new LinearGradient(0, 1, 1, 0.2, true, CycleMethod.NO_CYCLE,
new Stop(0.6, Color.color(1, 0.8, 0, 0.34)),
new Stop(0.85, Color.color(1, 0.8, 0, 0.74)),
new Stop(1, Color.WHITE));
p.fillProperty().bind(
Bindings.when(btn.pressedProperty()).then((Paint) Color.color(1, 0.8, 0, 0.75)).otherwise(g)
);
p.setStroke(Color.color(0.1, 0.1, 0.1, 0.15));
p.setEffect(new GaussianBlur());
// TODO: hover and/or focused?
p.visibleProperty().bind(btn.hoverProperty());
getChildren().addAll(btn, p);
}
代码示例来源:origin: com.github.almasb/fxgl-physics
Color color = Color.color(0, 0, 0);
for (Fixture f : b.getFixtures()) {
if (!b.isActive()) {
color = Color.color(0.5f, 0.5f, 0.3f);
drawShape(f, xf, color, wireframe);
} else if (b.getType() == BodyType.STATIC) {
color = Color.color(0.5f, 0.9f, 0.3f);
drawShape(f, xf, color, wireframe);
} else if (b.getType() == BodyType.KINEMATIC) {
color = Color.color(0.5f, 0.5f, 0.9f);
drawShape(f, xf, color, wireframe);
} else if (!b.isAwake()) {
color = Color.color(0.5f, 0.5f, 0.5f);
drawShape(f, xf, color, wireframe);
} else {
color = Color.color(0.9f, 0.7f, 0.7f);
drawShape(f, xf, color, wireframe);
color = Color.color(0.3f, 0.9f, 0.9f);
for (Contact c = world.getContactManager().m_contactList; c != null; c = c.getNext()) {
Fixture fixtureA = c.getFixtureA();
color = Color.color(0.9f, 0.3f, 0.9f);
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
circle.setFill(Color.color(0.52, 0.80, 0.92));
代码示例来源:origin: com.github.almasb/fxgl-base
PressAnyKeyState() {
getInput().addEventHandler(KeyEvent.KEY_PRESSED, e -> {
if (Input.isIllegal(e.getCode()))
return;
boolean rebound = FXGL.getInput().rebind(actionContext, e.getCode(), InputModifier.from(e));
if (rebound)
FXGL.getStateMachine().popState();
});
getInput().addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
boolean rebound = FXGL.getInput().rebind(actionContext, e.getButton(), InputModifier.from(e));
if (rebound)
FXGL.getStateMachine().popState();
});
Rectangle rect = new Rectangle(250, 100);
rect.setStroke(Color.color(0.85, 0.9, 0.9, 0.95));
rect.setStrokeWidth(10);
rect.setArcWidth(15);
rect.setArcHeight(15);
Text text = getUIFactory().newText(getLocalizedString("menu.pressAnyKey"), 24);
StackPane pane = new StackPane(rect, text);
pane.setTranslateX(FXGL.getAppWidth() / 2 - 125);
pane.setTranslateY(FXGL.getAppHeight() / 2 - 50);
getChildren().add(pane);
}
}
代码示例来源:origin: com.github.almasb/fxgl-physics
joint.getAnchorB(p2);
Color color = Color.color(0.5f, 0.8f, 0.8f);
内容来源于网络,如有侵权,请联系作者删除!