Java 类javafx.scene.paint.CycleMethod 实例源码

项目:marathonv5    文件:RadialGradientSample.java   
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);

    // show the circles
    getChildren().addAll(hb);
}
项目:marathonv5    文件:RadialGradientSample.java   
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);

    // show the circles
    getChildren().addAll(hb);
}
项目:charts    文件:AreaHeatMap.java   
private void draw(final int LIMIT, final double RESOLUTION) {
    int limit        = LIMIT > points.size() ? points.size() : LIMIT + 1;
    double pixelSize = 2 * RESOLUTION;

    ctx.clearRect(0, 0, width, height);

    for (double y = 0 ; y < height ; y += RESOLUTION) {
        for (double x = 0 ; x < width ; x += RESOLUTION) {
            double value = getValueAt(limit, x, y);
            if (value != -255) {
                Color          color    = getUseColorMapping() ? getColorForValue(value) : getColorForValue(value, isDiscreteColors());
                RadialGradient gradient = new RadialGradient(0, 0, x, y, RESOLUTION,
                                                             false, CycleMethod.NO_CYCLE,
                                                             new Stop(0, Color.color(color.getRed(), color.getGreen(), color.getBlue(), getHeatMapOpacity())),
                                                             new Stop(1, Color.color(color.getRed(), color.getGreen(), color.getBlue(), 0.0)));
                ctx.setFill(gradient);
                ctx.fillOval(x - RESOLUTION, y - RESOLUTION, pixelSize, pixelSize);
            }
        }
    }
}
项目:FXGLGames    文件:BreakoutApp.java   
private void initBackground() {
    Rectangle bg0 = new Rectangle(getWidth(), getHeight(),
            new LinearGradient(getWidth() / 2, 0, getWidth() / 2, getHeight(),
                    false, CycleMethod.NO_CYCLE,
                    new Stop(0.2, Color.AQUA), new Stop(0.8, Color.BLACK)));

    Rectangle bg1 = new Rectangle(getWidth(), getHeight(), Color.color(0, 0, 0, 0.2));
    bg1.setBlendMode(BlendMode.DARKEN);

    EntityView bg = new EntityView(RenderLayer.BACKGROUND);
    bg.addNode(bg0);
    bg.addNode(bg1);

    // we add IrremovableComponent because regardless of the level
    // the background and screen bounds stay in the game world
    Entities.builder()
            .viewFromNode(bg)
            .with(new IrremovableComponent())
            .buildAndAttach(getGameWorld());

    Entity screenBounds = Entities.makeScreenBounds(40);
    screenBounds.addComponent(new IrremovableComponent());

    getGameWorld().addEntity(screenBounds);
}
项目:openjfx-8u-dev-tests    文件:CanvasEffects2App.java   
@Override
public Node drawNode() {

    Group group = new Group();
    final Canvas canvas = new Canvas(120, 120);
    GraphicsContext gc = canvas.getGraphicsContext2D();
    group.getChildren().add(canvas);

    gc.setFill(Color.GREEN);
    gc.fillRect(10,10, 70, 70);

    ColorInput effect = new ColorInput();
    effect.setPaint(new LinearGradient(0, 0, 0.5f, 0.1f, true, CycleMethod.REPEAT, new Stop[] {
                    new Stop(0, Color.RED),
                    new Stop(1, Color.GREEN),
                }));
    effect.setX(15);
    effect.setY(15);
    effect.setWidth(70);
    effect.setHeight(70);

    gc.applyEffect(effect);
    return group;

}
项目:Medusa    文件:SectionSkin.java   
private void createNeedle() {
    double needleWidth  = size * 0.04;
    double needleHeight = size * 0.4675;
    needle.getElements().clear();
    needle.getElements().add(new MoveTo(0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.3125 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.4375 * needleWidth, 0.0,
                                              0.5 * needleWidth, 0.0));
    needle.getElements().add(new CubicCurveTo(0.5625 * needleWidth, 0.0,
                                              0.6875 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.6875 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.6875 * needleWidth, 0.015957446808510637 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new LineTo(0.0, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.0, 0.9946808510638298 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new ClosePath());
    needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
                                      needle.getLayoutBounds().getMaxX(), 0,
                                      false, CycleMethod.NO_CYCLE,
                                      new Stop(0.0, gauge.getNeedleColor().darker()),
                                      new Stop(0.5, gauge.getNeedleColor()),
                                      new Stop(1.0, gauge.getNeedleColor().darker())));
}
项目:Medusa    文件:SectionSkin.java   
@Override protected void redraw() {
    sectionsVisible = gauge.getSectionsVisible();
    drawSections();
    needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
                                      needle.getLayoutBounds().getMaxX(), 0,
                                      false, CycleMethod.NO_CYCLE,
                                      new Stop(0.0, gauge.getNeedleColor().darker()),
                                      new Stop(0.5, gauge.getNeedleColor()),
                                      new Stop(1.0, gauge.getNeedleColor().darker())));
    titleText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());
    mask.setFill(gauge.getBackgroundPaint());
    knob.setFill(gauge.getKnobColor());
    titleText.setText(gauge.getTitle());
    resizeText();
}
项目:Medusa    文件:ModernSkin.java   
public void handleMouseEvent(final MouseEvent EVENT) {
    if (gauge.isDisabled()) return;
    final EventType TYPE = EVENT.getEventType();
    if (MouseEvent.MOUSE_PRESSED.equals(TYPE)) {
        gauge.fireEvent(gauge.BTN_PRESSED_EVENT);
        centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
                                              0.5 * size, 0.7291666666666666 * size,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0.0, Color.rgb(31, 31, 31)),
                                              new Stop(1.0, Color.rgb(69, 70, 73))));
        valueText.setTranslateY(size * 0.501);
        subTitleText.setTranslateY(size * 0.3525);
        unitText.setTranslateY(size * 0.6675);
    } else if (MouseEvent.MOUSE_RELEASED.equals(TYPE)) {
        gauge.fireEvent(gauge.BTN_RELEASED_EVENT);
        centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
                                              0.5 * size, 0.7291666666666666 * size,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0.0, Color.rgb(69, 70, 73)),
                                              new Stop(1.0, Color.rgb(31, 31, 31))));
        valueText.setTranslateY(size * 0.5);
        subTitleText.setTranslateY(size * 0.35);
        unitText.setTranslateY(size * 0.67);
    }
}
项目:FXGLGames    文件:BreakoutApp.java   
private void initBackground() {
    Rectangle bg0 = new Rectangle(getWidth(), getHeight(),
            new LinearGradient(getWidth() / 2, 0, getWidth() / 2, getHeight(),
                    false, CycleMethod.NO_CYCLE,
                    new Stop(0.2, Color.AQUA), new Stop(0.8, Color.BLACK)));

    Rectangle bg1 = new Rectangle(getWidth(), getHeight(), Color.color(0, 0, 0, 0.2));
    bg1.setBlendMode(BlendMode.DARKEN);

    EntityView bg = new EntityView(RenderLayer.BACKGROUND);
    bg.addNode(bg0);
    bg.addNode(bg1);

    // we add IrremovableComponent because regardless of the level
    // the background and screen bounds stay in the game world
    Entities.builder()
            .viewFromNode(bg)
            .with(new IrremovableComponent())
            .buildAndAttach(getGameWorld());

    Entity screenBounds = Entities.makeScreenBounds(40);
    screenBounds.addComponent(new IrremovableComponent());

    getGameWorld().addEntity(screenBounds);
}
项目:The-Projects    文件:Player.java   
/**
 * Constructor without cards
 * @param name the name of the player
 * @param role the role of the player
 */
public Player(String name, Role role) {
    this.name = name;
    this.role = role;
    color = role.roleToColor();
    hand = new LinkedList<>();
    handDeck = null;
    pane = new Pane();
    pane.setBackground(new Background(new BackgroundFill(new RadialGradient(0, 0, .5, .5, .8, true, CycleMethod.NO_CYCLE, new Stop(0, color.deriveColor(0,1,1,.25)), new Stop(1, color.deriveColor(0,1,.5,.25))), new CornerRadii(5), new Insets(0))));

    Label description = new Label(role.roleToDescription());
    description.setTextFill(role.roleToColor().brighter());
    pane.getChildren().add(description);
    nameLabel = new Label(name);
    nameLabel.setTextFill(role.roleToColor().brighter());
    nameLabel.setLayoutX(350);
    nameLabel.setLayoutY(20);
    pane.getChildren().add(nameLabel);


    pawn = new Pawn(this);
}
项目:examples-javafx-repos1    文件:Overlay1Controller.java   
private void createTopHighlightBorder() {
    Stop[] stops = new Stop[] {
            new Stop(0, Color.WHITE),
            new Stop(.3, Color.LIGHTGRAY),
            new Stop(1, Color.TRANSPARENT)
    };
    LinearGradient lg1 = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);

    topHighlightBorder =
            new Border(new BorderStroke(
                    lg1, null, null, null,
                    BorderStrokeStyle.SOLID, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE,
                    CornerRadii.EMPTY,
                    new BorderWidths( 8.0d ),
                    null
            ));
}
项目:org.csstudio.display.builder    文件:ThermometerRepresentation.java   
Thermo(Color color)
{
    setFill(color);

    fill.setArcHeight(6);
    fill.setArcWidth(6);
    fill.setManaged(false);
    border.setFill(new LinearGradient(.3, 0, .7, 0, true, CycleMethod.NO_CYCLE,
            new Stop(0, Color.LIGHTGRAY),
            new Stop(.3, Color.WHITESMOKE),
            new Stop(1, Color.LIGHTGRAY)));
    border.setStroke(Color.BLACK);
    arc.setLargeArcFlag(true);
    rightcorner.setY(0);

    getChildren().add(border);
    getChildren().add(fill);
    getChildren().add(ellipse);
    setBorder(new Border(
            new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
项目:org.csstudio.display.builder    文件:ThermoDemo.java   
Thermo(Color color)
{
    setFill(color);

    fill.setArcHeight(3);
    fill.setArcWidth(3);
    fill.setManaged(false);
    border.setFill(new LinearGradient(.3, 0, .7, 0, true, CycleMethod.NO_CYCLE,
                                    new Stop(0, Color.LIGHTGRAY),
                                    new Stop(.3, Color.WHITESMOKE),
                                    new Stop(1, Color.LIGHTGRAY)));
    border.setStroke(Color.BLACK);
    arc.setLargeArcFlag(true);

    getChildren().add(border);
    getChildren().add(fill);
    getChildren().add(ellipse);
    setBorder(new Border(
            new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
项目:JavaOne2015JavaFXPitfalls    文件:Utils.java   
/**
 * Create an alpha masked ball with gradient colors from White to Black/Transparent. Used e. g. for particles.
 * May only be visible when you have a background other than white, ie use black
 *
 * @param radius
 * @return
 */
public static Node createAlphaMaskedBall( double radius) {

    Circle ball = new Circle(radius);

    RadialGradient gradient1 = new RadialGradient(0,
            .1,
            0,
            0,
            radius,
            false,
            CycleMethod.NO_CYCLE,
            new Stop(0, Color.WHITE.deriveColor(1,1,1,1)),
            new Stop(1, Color.BLACK.deriveColor(1,1,1,0)));

    ball.setFill(gradient1);

    return ball;
}
项目:POL-POM-5    文件:AbstractStepRepresentation.java   
protected void drawLeftImage() {
    AnchorPane pane = new AnchorPane();
    pane.setPrefWidth(187);
    Stop[] stops = new Stop[] { new Stop(0, Color.web("#3c79b2")), new Stop(1, Color.web("#2d5d8b")) };
    RadialGradient gradient = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, stops);

    Background background = new Background(new BackgroundFill(gradient, null, null));
    pane.setBackground(background);

    Text text = new Text(this.parent.getLeftImageText());
    text.setFill(Color.WHITE);
    text.setFont(Font.font("Maven Pro", 50));
    text.setRotate(-90);
    pane.setPadding(new Insets(-50));
    pane.getChildren().add(text);
    AnchorPane.setBottomAnchor(text, 160.0);
    AnchorPane.setRightAnchor(text, -40.0);

    getParent().getRoot().setLeft(pane);
}
项目:javafx-demos    文件:DisplacementMapBannerDemo.java   
public Banner(String message) {
    Rectangle rectangle = RectangleBuilder
            .create()
            .x(0)
            .y(0)
            .width(W)
            .height(H)
            .fill(LinearGradientBuilder
                    .create()
                    .startX(0.0)
                    .startY(0.0)
                    .endX(10.0)
                    .endY(0.0)
                    .proportional(false)
                    .cycleMethod(CycleMethod.REFLECT)
                    .stops(StopBuilder.create().offset(0.0).color(Color.BLUE).build(),
                            StopBuilder.create().offset(1.0).color(Color.LIGHTBLUE).build()).build()).build();
    Text text = TextBuilder.create().x(25).y(H / 16).text(message).fill(Color.YELLOW).font(Font.font(null, FontWeight.BOLD, 36))
            .build();
    getChildren().addAll(rectangle, text);
}
项目:kotlinfx-ensemble    文件:RadialGradientSample.java   
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);

    // show the circles
    getChildren().addAll(hb);
}
项目:AudioVisualizer2.0    文件:RenderTestVis2Frame.java   
private void changeGradient2Color(int index, Color color)
{
    if (index == 0)
    {
        stopsInner[index] = new Stop (0, color);
    } else if (index == 1)
    {
        stopsInner[index] = new Stop (.1, color);
    } else if (index == 2)
    {
        stopsInner[index] = new Stop (.8, color);
    } else if (index == 3)
    {
        stopsInner[index] = new Stop (1, color);
    }
    // reset the gradient containing the given color
    lg2 = new LinearGradient (0, 0, 0, .5, true, CycleMethod.REFLECT,
            stopsInner);
}
项目:AudioVisualizer2.0    文件:RenderTestVisFrame.java   
private void changeGradient2Color(int index, Color color)
{
    if (index == 0)
    {
        stopsInner[index] = new Stop (0, color);
    } else if (index == 1)
    {
        stopsInner[index] = new Stop (.1, color);
    } else if (index == 2)
    {
        stopsInner[index] = new Stop (.8, color);
    } else if (index == 3)
    {
        stopsInner[index] = new Stop (1, color);
    }
    // reset the gradient containing the given color
    lg2 = new LinearGradient (0, 0, 0, .5, true, CycleMethod.REFLECT,
            stopsInner);
}
项目:RadialFx    文件:RadialGlobalMenu.java   
public void addMenuItem(final String iconPath,
    final EventHandler<MouseEvent> eventHandler) {

final RadialGradient backGradient = new RadialGradient(0, 0, 0, 0,
    radius.get(), false, CycleMethod.NO_CYCLE, new Stop(0,
        BACK_GRADIENT_COLOR), new Stop(1, Color.TRANSPARENT));

final RadialGradient backSelectGradient = new RadialGradient(0, 0, 0,
    0, radius.get(), false, CycleMethod.NO_CYCLE, new Stop(0,
        BACK_SELECT_GRADIENT_COLOR), new Stop(1,
        Color.TRANSPARENT));

final RadialMenuItem item = RadialMenuItemBuilder.create()
    .length(length).graphic(new Group(getImageView(iconPath)))
    .backgroundFill(backGradient)
    .backgroundMouseOnFill(backSelectGradient)
    .innerRadius(innerRadius).radius(radius).offset(offset)
    .clockwise(true).backgroundVisible(true).strokeVisible(false)
    .build();

item.setOnMouseClicked(eventHandler);

items.add(item);
itemsContainer.getChildren().addAll(item);
   }
项目:GraphCreator    文件:Themes.java   
private static void traffic(LineGraph graph){
    graph.setClose(false);

    graphPath.setStrokeWidth(4);
    graphPath.setStroke(new LinearGradient(0,0,0,1,true, CycleMethod.NO_CYCLE,
                        new Stop(0, Color.valueOf("#03A9F4")),
                        new Stop(0.7,Color.valueOf("#f47536")), new Stop(1,Color.valueOf("#d32f2f"))));

    lines.setStroke(Color.TRANSPARENT);
    dots.setFill(Color.TRANSPARENT);
}
项目:incubator-netbeans    文件:StopWatch.java   
private void configureDesign() {
    rectangleVisual.setLayoutY(0f);
    rectangleVisual.setLayoutX(-14);
    rectangleVisual.setFill(Color.TRANSPARENT);

    rectangleSmall.setLayoutX(-7);
    rectangleSmall.setLayoutY(5);
    rectangleSmall.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorWeak),
                new Stop(0.5, colorStrong),
                new Stop(1, colorWeak)}));

    rectangleBig.setLayoutX(-14);
    rectangleBig.setLayoutY(0);
    rectangleBig.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorStrong),
                new Stop(0.5, colorWeak),
                new Stop(1, colorStrong)}));

    rectangleWatch.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, Color.web("#4e605f")),
                new Stop(0.2, Color.web("#c3d6d5")),
                new Stop(0.5, Color.web("#f9ffff")),
                new Stop(0.8, Color.web("#c3d6d5")),
                new Stop(1, Color.web("#4e605f"))}));
    rectangleWatch.setLayoutX(-12);
    rectangleWatch.setLayoutY(12);
}
项目:marathonv5    文件:SimpleHSBColorPicker.java   
private LinearGradient buildHueBar() {
    double offset;
    Stop[] stops = new Stop[255];
    for (int y = 0; y < 255; y++) {
        offset = (double) (1.0 / 255) * y;
        int h = (int)((y / 255.0) * 360);
        stops[y] = new Stop(offset, Color.hsb(h, 1.0, 1.0));
    }
    return new LinearGradient(0f, 0f, 1f, 0f, true, CycleMethod.NO_CYCLE, stops);
}
项目:marathonv5    文件:StopWatchSample.java   
private void configureDesign() {
    rectangleVisual.setLayoutY(0f);
    rectangleVisual.setLayoutX(-14);
    rectangleVisual.setFill(Color.TRANSPARENT);

    rectangleSmall.setLayoutX(-7);
    rectangleSmall.setLayoutY(5);
    rectangleSmall.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorWeak),
                new Stop(0.5, colorStrong),
                new Stop(1, colorWeak)}));

    rectangleBig.setLayoutX(-14);
    rectangleBig.setLayoutY(0);
    rectangleBig.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorStrong),
                new Stop(0.5, colorWeak),
                new Stop(1, colorStrong)}));

    rectangleWatch.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, Color.web("#4e605f")),
                new Stop(0.2, Color.web("#c3d6d5")),
                new Stop(0.5, Color.web("#f9ffff")),
                new Stop(0.8, Color.web("#c3d6d5")),
                new Stop(1, Color.web("#4e605f"))}));
    rectangleWatch.setLayoutX(-12);
    rectangleWatch.setLayoutY(12);
}
项目:marathonv5    文件:LinearGradientSample.java   
public LinearGradientSample() {
    //First rectangle
    Rectangle rect1 = new Rectangle(0,0,80,80);

    //create simple linear gradient
    LinearGradient gradient1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });

    //set rectangle fill
    rect1.setFill(gradient1);

    // Second rectangle
    Rectangle rect2 = new Rectangle(0,0,80,80);

    //create complex linear gradient
    LinearGradient gradient2 = new LinearGradient(0, 0, 0, 0.5,  true, CycleMethod.REFLECT, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(0.1, Color.BLACK),
        new Stop(1, Color.DODGERBLUE)
    });

    //set rectangle fill
    rect2.setFill(gradient2);

    // show the rectangles
    HBox hb = new HBox(10);
    hb.getChildren().addAll(rect1, rect2);
    getChildren().add(hb);
}
项目:marathonv5    文件:LinearGradientSample.java   
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
项目:marathonv5    文件:RadialGradientSample.java   
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
项目:marathonv5    文件:ColorSample.java   
public static Node createIconContent() {
    double offset;
    Stop[] stops = new Stop[255];
    for (int y = 0; y < 255; y++) {
        offset = (double) (1.0 / 255) * y;
        int h = (int)((y / 255.0) * 360);
        stops[y] = new Stop(offset, Color.hsb(h, 0.8, 0.9));
    }
    Rectangle rect = new Rectangle(80,80,
            new LinearGradient(0f, 0f, 1f, 1f, true, CycleMethod.NO_CYCLE, stops));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
项目:marathonv5    文件:SimpleHSBColorPicker.java   
private LinearGradient buildHueBar() {
    double offset;
    Stop[] stops = new Stop[255];
    for (int y = 0; y < 255; y++) {
        offset = (double) (1.0 / 255) * y;
        int h = (int)((y / 255.0) * 360);
        stops[y] = new Stop(offset, Color.hsb(h, 1.0, 1.0));
    }
    return new LinearGradient(0f, 0f, 1f, 0f, true, CycleMethod.NO_CYCLE, stops);
}
项目:marathonv5    文件:StopWatchSample.java   
private void configureDesign() {
    rectangleVisual.setLayoutY(0f);
    rectangleVisual.setLayoutX(-14);
    rectangleVisual.setFill(Color.TRANSPARENT);

    rectangleSmall.setLayoutX(-7);
    rectangleSmall.setLayoutY(5);
    rectangleSmall.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorWeak),
                new Stop(0.5, colorStrong),
                new Stop(1, colorWeak)}));

    rectangleBig.setLayoutX(-14);
    rectangleBig.setLayoutY(0);
    rectangleBig.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorStrong),
                new Stop(0.5, colorWeak),
                new Stop(1, colorStrong)}));

    rectangleWatch.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, Color.web("#4e605f")),
                new Stop(0.2, Color.web("#c3d6d5")),
                new Stop(0.5, Color.web("#f9ffff")),
                new Stop(0.8, Color.web("#c3d6d5")),
                new Stop(1, Color.web("#4e605f"))}));
    rectangleWatch.setLayoutX(-12);
    rectangleWatch.setLayoutY(12);
}
项目:marathonv5    文件:LinearGradientSample.java   
public LinearGradientSample() {
    //First rectangle
    Rectangle rect1 = new Rectangle(0,0,80,80);

    //create simple linear gradient
    LinearGradient gradient1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });

    //set rectangle fill
    rect1.setFill(gradient1);

    // Second rectangle
    Rectangle rect2 = new Rectangle(0,0,80,80);

    //create complex linear gradient
    LinearGradient gradient2 = new LinearGradient(0, 0, 0, 0.5,  true, CycleMethod.REFLECT, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(0.1, Color.BLACK),
        new Stop(1, Color.DODGERBLUE)
    });

    //set rectangle fill
    rect2.setFill(gradient2);

    // show the rectangles
    HBox hb = new HBox(10);
    hb.getChildren().addAll(rect1, rect2);
    getChildren().add(hb);
}
项目:marathonv5    文件:LinearGradientSample.java   
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
项目:marathonv5    文件:RadialGradientSample.java   
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
项目:marathonv5    文件:ColorSample.java   
public static Node createIconContent() {
    double offset;
    Stop[] stops = new Stop[255];
    for (int y = 0; y < 255; y++) {
        offset = (double) (1.0 / 255) * y;
        int h = (int)((y / 255.0) * 360);
        stops[y] = new Stop(offset, Color.hsb(h, 0.8, 0.9));
    }
    Rectangle rect = new Rectangle(80,80,
            new LinearGradient(0f, 0f, 1f, 1f, true, CycleMethod.NO_CYCLE, stops));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
项目:HotaruFX    文件:ColorPickerBox.java   
private static LinearGradient createHueGradient() {
    final Stop[] stops = new Stop[255];
    for (int x = 0; x < 255; x++) {
        final double offset = (1.0 / 255.0) * x;
        final int hue = (int)((x / 255.0) * 360);
        stops[x] = new Stop(offset, Color.hsb(hue, 1.0, 1.0));
    }
    return new LinearGradient(0f, 0f, 1f, 0f, true, CycleMethod.NO_CYCLE, stops);
}
项目:GazePlay    文件:Clavier.java   
public Clavier(Instru instru) {

        this.instru = instru;// l'objet de type Instru prend la valeur de l'objet passé en paramètre

        Rectangle fond_clavier = new Rectangle();
        fond_clavier.setWidth(400);
        fond_clavier.setHeight(200);
        fond_clavier.setArcWidth(30);
        fond_clavier.setArcHeight(30);
        fond_clavier.setFill( // on remplie notre rectangle avec un dégradé
                new LinearGradient(0f, 0f, 0f, 1f, true, CycleMethod.NO_CYCLE,
                        new Stop[] { new Stop(0, Color.web("#333333")), new Stop(1, Color.web("#000000")) }));
        Reflection r = new Reflection();// on applique un effet de réflection
        r.setFraction(0.25);
        r.setBottomOpacity(0);
        r.setTopOpacity(0.5);
        fond_clavier.setEffect(r);

        touches = new Touche[] { new Touche("U", 50, 20, 60, instru), new Touche("I", 128, 20, 62, instru),
                new Touche("O", 206, 20, 64, instru), new Touche("P", 284, 20, 65, instru),
                new Touche("J", 75, 98, 67, instru), new Touche("K", 153, 98, 69, instru),
                new Touche("L", 231, 98, 71, instru), new Touche("M", 309, 98, 72, instru) };

        this.setTranslateX(50);
        this.setTranslateY(250);
        this.getChildren().add(fond_clavier);

        for (Touche touche : touches) { // on insère chaque touche une par une.
            this.getChildren().add(touche);
        }

    }
项目:charts    文件:Helper.java   
public static final LinearGradient createColorVariationGradient(final Color COLOR, final int NO_OF_COLORS) {
    List<Color> colorVariations = createColorVariations(COLOR, NO_OF_COLORS);
    List<Stop>  stops = new ArrayList<>(NO_OF_COLORS);
    double step = 1.0 / NO_OF_COLORS;
    for (int i = 0 ; i < NO_OF_COLORS ; i++) {
        stops.add(new Stop(i * step, colorVariations.get(i)));
    }
    return new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);
}
项目:charts    文件:RadarChartTest.java   
@Override public void init() {
    List<YChartItem> item1 = new ArrayList<>(ELEMENTS);
    List<YChartItem> item2 = new ArrayList<>(ELEMENTS);
    List<YChartItem> item3 = new ArrayList<>(ELEMENTS);
    for (int i = 0 ; i < ELEMENTS ; i++) {
        YChartItem dataPoint;

        dataPoint = new YChartItem(RND.nextDouble() * 100, "P" + i);
        item1.add(dataPoint);

        dataPoint = new YChartItem(RND.nextDouble() * 100, "P" + i);
        item2.add(dataPoint);

        dataPoint = new YChartItem(RND.nextDouble() * 100, "P" + i);
        item3.add(dataPoint);
    }

    series1 = new YSeries(item3, CHART_TYPE, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(0, 255, 255, 0.25)), new Stop(0.5, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(255, 0, 255, 0.75))), Color.TRANSPARENT);
    series2 = new YSeries(item1, CHART_TYPE, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(255, 0, 0, 0.25)), new Stop(0.5, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(0, 200, 0, 0.75))), Color.TRANSPARENT);
    series3 = new YSeries(item2, CHART_TYPE, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(0, 255, 255, 0.25)), new Stop(0.5, Color.rgb(0, 255, 255, 0.5)), new Stop(1.0, Color.rgb(0, 0, 255, 0.75))), Color.TRANSPARENT);

    chart   = new YChart(new YPane(series1, series2, series3));
    chart.setPrefSize(600, 600);

    timeline      = new Timeline();
    lastTimerCall = System.nanoTime();
    timer         = new AnimationTimer() {
        @Override public void handle(final long now) {
            if (now > lastTimerCall + INTERVAL) {
                animateData();
                long delta = System.nanoTime() - now;
                timeline.play();
                lastTimerCall = now + delta;
            }
        }
    };

    registerListener();
}
项目:fx-animation-editor    文件:ColorPickerComponent.java   
private static LinearGradient createHueGradient() {
    double offset;
    Stop[] stops = new Stop[255];
    for (int x = 0; x < 255; x++) {
        offset = 1.0 / 255 * x;
        int h = (int) ((x / 255.0) * 360);
        stops[x] = new Stop(offset, Color.hsb(h, 1, 1));
    }
    return new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);
}
项目:tilesfx    文件:SparkLineTileSkin.java   
private void setupGradient() {
    double loFactor = (low - minValue) / tile.getRange();
    double hiFactor = (high - minValue) / tile.getRange();
    Stop   loStop   = new Stop(loFactor, gradientLookup.getColorAt(loFactor));
    Stop   hiStop   = new Stop(hiFactor, gradientLookup.getColorAt(hiFactor));
    gradient = new LinearGradient(0, graphBounds.getY() + graphBounds.getHeight(), 0, graphBounds.getY(), false, CycleMethod.NO_CYCLE, loStop, hiStop);
}