javafx.scene.shape.Arc#setEffect ( )源码实例Demo

下面列出了javafx.scene.shape.Arc#setEffect ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: marathonv5   文件: ArcSample.java
public static Node createIconContent() {
    Arc arc = new Arc(57,57,45,45,40,100);
    arc.setStroke(Color.web("#b9c0c5"));
    arc.setStrokeWidth(5);
    arc.getStrokeDashArray().addAll(15d,15d);
    arc.setFill(null);
    javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
    effect.setOffsetX(1);
    effect.setOffsetY(1);
    effect.setRadius(3);
    effect.setColor(Color.rgb(0,0,0,0.6));
    arc.setEffect(effect);
    return arc;
}
 
源代码2 项目: marathonv5   文件: ArcSample.java
public static Node createIconContent() {
    Arc arc = new Arc(57,57,45,45,40,100);
    arc.setStroke(Color.web("#b9c0c5"));
    arc.setStrokeWidth(5);
    arc.getStrokeDashArray().addAll(15d,15d);
    arc.setFill(null);
    javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
    effect.setOffsetX(1);
    effect.setOffsetY(1);
    effect.setRadius(3);
    effect.setColor(Color.rgb(0,0,0,0.6));
    arc.setEffect(effect);
    return arc;
}
 
源代码3 项目: Medusa   文件: WhiteSkin.java
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    shadow     = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 12, 0, 3, 3);
    textShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 4, 0, 2, 2);

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
    valueText.setFill(Color.WHITE);
    valueText.setFont(Fonts.robotoBold(PREFERRED_WIDTH * 0.20625));
    valueText.setTextOrigin(VPos.CENTER);
    valueText.relocate(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.46875);
    valueText.setEffect(textShadow);
    Helper.enableNode(valueText, gauge.isValueVisible());

    unitText  = new Text(gauge.getUnit());
    unitText.setFill(Color.WHITE);
    unitText.setFont(Fonts.robotoBold(PREFERRED_WIDTH * 0.0875));
    unitText.setTextOrigin(VPos.CENTER);
    unitText.relocate(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.65625);
    unitText.setEffect(textShadow);
    Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

    backgroundRing = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                             PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                             0, 360);
    backgroundRing.setFill(null);
    backgroundRing.setStroke(Color.rgb(255, 255, 255, 0.9));
    backgroundRing.setStrokeLineCap(StrokeLineCap.BUTT);
    backgroundRing.setStrokeWidth(PREFERRED_WIDTH * 0.1375);
    backgroundRing.setEffect(shadow);

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                            PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                            0, 360);
    barBackground.setFill(null);
    barBackground.setStroke(Color.rgb(255, 255, 255, 0.4));
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.1375);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                  PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                  90, -gauge.getAngleStep() * gauge.getValue());
    bar.setFill(null);
    bar.setStroke(Color.WHITE);
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.1375);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);

    pane = new Pane(valueText, unitText, backgroundRing, barBackground, bar);
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));

    getChildren().setAll(pane);
}
 
源代码4 项目: regulators   文件: ColorRegulator.java
private void initGraphics() {
    dropShadow  = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028);
    highlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    highlight.setInput(innerShadow);
    dropShadow.setInput(highlight);

    Stop[] stops = { new Stop(0.0, Color.rgb(255,255,0)),
                     new Stop(0.125, Color.rgb(255,0,0)),
                     new Stop(0.375, Color.rgb(255,0,255)),
                     new Stop(0.5, Color.rgb(0,0,255)),
                     new Stop(0.625, Color.rgb(0,255,255)),
                     new Stop(0.875, Color.rgb(0,255,0)),
                     new Stop(1.0, Color.rgb(255,255,0)) };

    List<Stop> reorderedStops = reorderStops(stops);

    gradientLookup = new GradientLookup(stops);

    barGradient = new ConicalGradient(reorderedStops);
    barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    barArc.setType(ArcType.OPEN);
    barArc.setStrokeLineCap(StrokeLineCap.ROUND);
    barArc.setFill(null);
    barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT)));

    buttonOn = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -125, 34.75);
    buttonOn.setFill(null);
    buttonOn.setStroke(color.get());
    buttonOn.setStrokeLineCap(StrokeLineCap.BUTT);
    buttonOn.setStrokeWidth(PREFERRED_WIDTH * 0.072);
    buttonOn.setEffect(dropShadow);

    buttonOff = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -89.75, 34.75);
    buttonOff.setFill(null);
    buttonOff.setStroke(color.get());
    buttonOff.setStrokeLineCap(StrokeLineCap.BUTT);
    buttonOff.setStrokeWidth(PREFERRED_WIDTH * 0.072);
    buttonOff.setEffect(dropShadow);

    double center = PREFERRED_WIDTH * 0.5;
    ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42),
                          new Circle(center, center, PREFERRED_WIDTH * 0.3));
    ring.setFill(color.get());
    ring.setEffect(highlight);

    mainCircle = new Circle();
    mainCircle.setFill(color.get().darker().darker());

    textOn = new Text("ON");
    textOn.setFill(textColor.get());
    textOn.setTextOrigin(VPos.CENTER);
    textOn.setMouseTransparent(true);
    textOn.setRotate(17);

    textOff = new Text("OFF");
    textOff.setFill(textColor.get());
    textOff.setTextOrigin(VPos.CENTER);
    textOff.setMouseTransparent(true);
    textOff.setRotate(-17);

    indicatorRotate = new Rotate(-ANGLE_RANGE *  0.5, center, center);

    indicatorGlow        = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0);
    indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    indicatorHighlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    indicatorHighlight.setInput(indicatorInnerShadow);

    indicator = new Circle();
    indicator.setFill(color.get().darker());
    indicator.setStroke(color.get().darker().darker());
    indicator.setMouseTransparent(true);
    indicator.getTransforms().add(indicatorRotate);

    Group indicatorGroup = new Group(indicator);
    indicatorGroup.setEffect(indicatorHighlight);

    innerRing = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.24),
                               new Circle(center, center, PREFERRED_WIDTH * 0.2));
    innerRing.setFill(color.get());

    currentColorCircle = new Circle();
    currentColorCircle.setFill(targetColor.get());
    currentColorCircle.setVisible(isOn());

    pane = new Pane(barArc, ring, mainCircle, currentColorCircle, innerRing, indicatorGroup, buttonOn, textOn, buttonOff, textOff);
    pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT);
    pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setEffect(highlight);

    getChildren().setAll(pane);
}