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

项目:marathonv5    文件:HeatTabController.java   
/**
 * Get the color at the give {@code position} in the ladder of color stops
 */
private static Color ladder(final double position, final Stop[] stops) {
    Stop prevStop = null;
    for (int i=0; i<stops.length; i++) {
        Stop stop = stops[i];
        if(position <= stop.getOffset()){
            if (prevStop == null) {
                return stop.getColor();
            } else {
                return interpolateLinear((position-prevStop.getOffset())/(stop.getOffset()-prevStop.getOffset()), prevStop.getColor(), stop.getColor());
            }
        }
        prevStop = stop;
    }
    // position is greater than biggest stop, so will we biggest stop's color
    return prevStop.getColor();
}
项目: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    文件:HeatTabController.java   
/**
 * Get the color at the give {@code position} in the ladder of color stops
 */
private static Color ladder(final double position, final Stop[] stops) {
    Stop prevStop = null;
    for (int i=0; i<stops.length; i++) {
        Stop stop = stops[i];
        if(position <= stop.getOffset()){
            if (prevStop == null) {
                return stop.getColor();
            } else {
                return interpolateLinear((position-prevStop.getOffset())/(stop.getOffset()-prevStop.getOffset()), prevStop.getColor(), stop.getColor());
            }
        }
        prevStop = stop;
    }
    // position is greater than biggest stop, so will we biggest stop's color
    return prevStop.getColor();
}
项目: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);
}
项目:mo-vnfcp    文件:GuiApp.java   
private Color getColor(double t) {
    if (t < 0 || t > 1) {
        throw new IllegalArgumentException("t = " + t);
    }

    for (int i = 1; i < colorStops.size(); i++) {
        Stop s = colorStops.get(i);
        Stop p = colorStops.get(i-1);
        if (t <= s.getOffset()) {
            double start = p.getOffset();
            double end = s.getOffset();

            return p.getColor().interpolate(s.getColor(), (t-start) / (end-start));
        }
    }

    throw new IllegalArgumentException("t > last stop's offset: t="+t+", offset="+colorStops.get(colorStops.size()-1));
}
项目:charts    文件:GradientLookup.java   
public Color getColorAt(final double POSITION_OF_COLOR) {
    if (stops.isEmpty()) return Color.BLACK;

    final double POSITION = Helper.clamp(0.0, 1.0, POSITION_OF_COLOR);
    final Color COLOR;
    if (stops.size() == 1) {
        final Map<Double, Color> ONE_ENTRY = (Map<Double, Color>) stops.entrySet().iterator().next();
        COLOR = stops.get(ONE_ENTRY.keySet().iterator().next()).getColor();
    } else {
        Stop lowerBound = stops.get(0.0);
        Stop upperBound = stops.get(1.0);
        for (Double fraction : stops.keySet()) {
            if (Double.compare(fraction,POSITION) < 0) {
                lowerBound = stops.get(fraction);
            }
            if (Double.compare(fraction, POSITION) > 0) {
                upperBound = stops.get(fraction);
                break;
            }
        }
        COLOR = interpolateColor(lowerBound, upperBound, POSITION);
    }
    return COLOR;
}
项目: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);
            }
        }
    }
}
项目:charts    文件:GradientLookup.java   
public Color getColorAt(final double POSITION_OF_COLOR) {
    if (stops.isEmpty()) return Color.BLACK;

    final double POSITION = Helper.clamp(0.0, 1.0, POSITION_OF_COLOR);
    final Color COLOR;
    if (stops.size() == 1) {
        final Map<Double, Color> ONE_ENTRY = (Map<Double, Color>) stops.entrySet().iterator().next();
        COLOR = stops.get(ONE_ENTRY.keySet().iterator().next()).getColor();
    } else {
        Stop lowerBound = stops.get(0.0);
        Stop upperBound = stops.get(1.0);
        for (Double fraction : stops.keySet()) {
            if (Double.compare(fraction,POSITION) < 0) {
                lowerBound = stops.get(fraction);
            }
            if (Double.compare(fraction, POSITION) > 0) {
                upperBound = stops.get(fraction);
                break;
            }
        }
        COLOR = interpolateColor(lowerBound, upperBound, POSITION);
    }
    return COLOR;
}
项目:enders_game    文件:Bullet.java   
/**
* The constructor for a bullet.
* 
* @param radius - the radius of the bullet
* @param fill - the color of the bullet highlight
*/
  public Bullet(double radius, Color fill) {
      sphere = CircleBuilder.create()
              .centerX(radius)
              .centerY(radius)
              .radius(radius)
              .cache(true)
              .build();

      RadialGradient rgrad = RadialGradientBuilder.create()
                  .centerX(sphere.getCenterX() - sphere.getRadius() / 3)
                  .centerY(sphere.getCenterY() - sphere.getRadius() / 3)
                  .radius(sphere.getRadius())
                  .proportional(false)
                  .stops(new Stop(0.0, fill), new Stop(1.0, Settings.BULLET_PRIMARY_COLOR))
                  .build();

      sphere.setFill(rgrad);
  }
项目: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);
}
项目:ColorSelector    文件:GradientLookup.java   
public Color getColorAt(final double POSITION_OF_COLOR) {
    if (stops.isEmpty()) return Color.BLACK;

    final double POSITION = clamp(0d, 1d, POSITION_OF_COLOR);
    final Color COLOR;
    if (stops.size() == 1) {
        final Map<Double, Color> ONE_ENTRY = (Map<Double, Color>) stops.entrySet().iterator().next();
        COLOR = stops.get(ONE_ENTRY.keySet().iterator().next()).getColor();
    } else {
        Stop lowerBound = stops.get(0.0);
        Stop upperBound = stops.get(1.0);
        for (Double fraction : stops.keySet()) {
            if (Double.compare(fraction,POSITION) < 0) {
                lowerBound = stops.get(fraction);
            }
            if (Double.compare(fraction, POSITION) > 0) {
                upperBound = stops.get(fraction);
                break;
            }
        }
        COLOR = interpolateColor(lowerBound, upperBound, POSITION);
    }
    return COLOR;
}
项目:MoodFX    文件:GradientLookup.java   
public Color getColorAt(final double POSITION_OF_COLOR) {
    if (stops.isEmpty()) return Color.BLACK;

    final double POSITION = clamp(0d, 1d, POSITION_OF_COLOR);
    final Color COLOR;
    if (stops.size() == 1) {
        final Map<Double, Color> ONE_ENTRY = (Map<Double, Color>) stops.entrySet().iterator().next();
        COLOR = stops.get(ONE_ENTRY.keySet().iterator().next()).getColor();
    } else {
        Stop lowerBound = stops.get(0.0);
        Stop upperBound = stops.get(1.0);
        for (Double fraction : stops.keySet()) {
            if (Double.compare(fraction,POSITION) < 0) {
                lowerBound = stops.get(fraction);
            }
            if (Double.compare(fraction, POSITION) > 0) {
                upperBound = stops.get(fraction);
                break;
            }
        }
        COLOR = interpolateColor(lowerBound, upperBound, POSITION);
    }
    return COLOR;
}
项目:medusademo    文件:InteractiveGaugeSkin.java   
private void drawGradientBar() {
    double     xy     = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.115 * size : 0.0515 * size;
    double     wh     = TickLabelLocation.OUTSIDE == tickLabelLocation ? size * 0.77 : size * 0.897;
    double     offset = 90 - startAngle;
    List<Stop> stops  = getSkinnable().getGradientBarStops();
    Map<Double, Color> stopAngleMap     = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double                  offsetFactor        = ScaleDirection.CLOCKWISE == scaleDirection ? (startAngle - 90) : (startAngle + 180);
    AngleConicalGradient    gradient            = new AngleConicalGradient(size * 0.5, size * 0.5, offsetFactor, stopAngleMap, getSkinnable().getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? getSkinnable().getRange() * angleStep : -getSkinnable().getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * size, xy - 0.026 * size, wh + 0.052 * size, wh + 0.052 * size)));
    tickMarkCtx.setLineWidth(size * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:regulators    文件:ConicalGradient.java   
private List<Stop> normalizeStops(final double OFFSET, final List<Stop> STOPS) {
    double offset = clamp(0.0, 1.0, OFFSET);
    List<Stop> stops;
    if (null == STOPS || STOPS.isEmpty()) {
        stops = new ArrayList<>();
        stops.add(new Stop(0.0, Color.TRANSPARENT));
        stops.add(new Stop(1.0, Color.TRANSPARENT));
    } else {
        stops = STOPS;
    }
    List<Stop> sortedStops = calculate(stops, offset);

    // Reverse the Stops for CCW direction
    if (ScaleDirection.COUNTER_CLOCKWISE == scaleDirection) {
        List<Stop> sortedStops3 = new ArrayList<>();
        Collections.reverse(sortedStops);
        for (Stop stop : sortedStops) { sortedStops3.add(new Stop(1.0 - stop.getOffset(), stop.getColor())); }
        sortedStops = sortedStops3;
    }
    return sortedStops;
}
项目: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    文件:HSkin.java   
private void drawGradientBar() {
    double     scaledWidth = width * 0.9;
    double     xy          = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.1705 * scaledWidth : 0.107 * scaledWidth;
    double     wh          = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledWidth * 0.77 : scaledWidth * 0.897;
    double     offsetY     = -0.1 * height;
    double     offset      = 90 - startAngle;
    List<Stop> stops       = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double               offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? startAngle - angleRange + 180 : (startAngle + 180);
    AngleConicalGradient gradient     = new AngleConicalGradient(width * 0.5, width * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * width, xy - 0.026 * width + offsetY, wh + 0.052 * width, wh + 0.052 * width)));
    tickMarkCtx.setLineWidth(scaledWidth * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy, xy + offsetY, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:QuarterSkin.java   
private void drawGradientBar() {
    Pos                knobPosition      = gauge.getKnobPosition();
    TickLabelLocation  tickLabelLocation = gauge.getTickLabelLocation();
    double             scaledSize        = size * 1.9;
    double             xy                = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.105 * scaledSize : 0.03875 * scaledSize;
    double             wh                = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledSize * 0.79 : scaledSize * 0.925;
    double             offsetX           = Pos.TOP_LEFT == knobPosition || Pos.BOTTOM_LEFT == knobPosition ? -scaledSize * 0.475 : 0;
    double             offsetY           = Pos.TOP_LEFT == knobPosition || Pos.TOP_RIGHT == knobPosition ? -scaledSize * 0.475 : 0;
    double             offset            = 90 - startAngle;
    ScaleDirection     scaleDirection    = gauge.getScaleDirection();
    List<Stop>         stops             = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap      = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * ANGLE_RANGE, stop.getColor()); }
    double               offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? (Pos.TOP_LEFT == knobPosition || Pos.BOTTOM_RIGHT == knobPosition ? startAngle : 180 - startAngle) : (startAngle + 180);
    AngleConicalGradient gradient     = new AngleConicalGradient(scaledSize * 0.5, scaledSize * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * scaledSize + offsetX, xy - 0.026 * scaledSize + offsetY, wh + 0.052 * scaledSize, wh + 0.052 * scaledSize)));
    tickMarkCtx.setLineWidth(scaledSize * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy + offsetX, xy + offsetY, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:VSkin.java   
private void drawGradientBar() {
    TickLabelLocation  tickLabelLocation     = gauge.getTickLabelLocation();
    double             scaledHeight          = height * 0.9;
    double             xy                    = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.1705 * scaledHeight : 0.107 * scaledHeight;
    double             wh                    = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledHeight * 0.77 : scaledHeight * 0.897;
    double             offset                = 90 - startAngle;
    double             offsetX               = -0.1 * width;
    double             knobPositionOffsetCW  = Pos.CENTER_LEFT == gauge.getKnobPosition() ? 90 : 270;
    double             knobPositionOffsetCCW = Pos.CENTER_LEFT == gauge.getKnobPosition() ? 180 : 0;
    ScaleDirection     scaleDirection        = gauge.getScaleDirection();
    List<Stop>         stops                 = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap          = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double               offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? knobPositionOffsetCW - angleRange * 0.5 : angleRange - (angleRange / 180 * angleRange) + knobPositionOffsetCCW;
    AngleConicalGradient gradient     = new AngleConicalGradient(width * 0.5, width * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * height + offsetX, xy - 0.026 * height, wh + 0.052 * height, wh + 0.052 * height)));
    tickMarkCtx.setLineWidth(scaledHeight * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy + offsetX, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:GaugeSkin.java   
private void drawGradientBar() {
    double     xy     = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.115 * size : 0.0515 * size;
    double     wh     = TickLabelLocation.OUTSIDE == tickLabelLocation ? size * 0.77 : size * 0.897;
    double     offset = 90 - startAngle;
    List<Stop> stops  = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap     = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double                  offsetFactor        = ScaleDirection.CLOCKWISE == scaleDirection ? (startAngle - 90) : (startAngle + 180);
    AngleConicalGradient    gradient            = new AngleConicalGradient(size * 0.5, size * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * size, xy - 0.026 * size, wh + 0.052 * size, wh + 0.052 * size)));
    tickMarkCtx.setLineWidth(size * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:TinySkin.java   
private void drawGradientBar() {
    double             xy           = size * 0.1875;
    double             wh           = size * 0.625;
    double             offset       = -ANGLE_RANGE * 0.5 - 90;
    double             startAngle   = 315;
    List<Stop>         stops        = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * ANGLE_RANGE, stop.getColor()); }
    double               offsetFactor = startAngle - 90;
    AngleConicalGradient gradient     = new AngleConicalGradient(size * 0.5, size * 0.5, offsetFactor, stopAngleMap, ScaleDirection.CLOCKWISE);

    double barStartAngle  = 0;
    double barAngleExtend = 270;
    sectionCtx.save();
    sectionCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.09191176 * size, xy - 0.09191176 * size, wh + 0.18382353 * size, wh + 0.18382353 * size)));
    sectionCtx.setLineWidth(size * 0.18382353);
    sectionCtx.setLineCap(StrokeLineCap.BUTT);
    sectionCtx.strokeArc(xy, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    sectionCtx.restore();    
}
项目:Medusa    文件:BarSkin.java   
public BarSkin(Gauge gauge) {
    super(gauge);
    if (gauge.isAutoScale()) gauge.calcAutoScale();
    range                = gauge.getRange();
    angleStep            = -ANGLE_RANGE / range;
    currentValueListener = o -> redraw();
    barColorListener     = o -> {
        Color barColor = gauge.getBarColor();
        gauge.setGradientBarStops(new Stop(0.0, barColor),
                                  new Stop(0.01, barColor),
                                  new Stop(0.75, barColor.deriveColor(-10, 1, 1, 1)),
                                  new Stop(1.0, barColor.deriveColor(-20, 1, 1, 1)));
        resize();
    };
    titleListener = o -> {
        titleText.setText(gauge.getTitle());
        resizeTitleText();
    };
    unitListener = o -> {
        unitText.setText(gauge.getUnit());
        resizeUnitText();
    };

    initGraphics();
    registerListeners();
}
项目: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);
        }

    }
项目:can4eve    文件:ChargePane.java   
/**
 * charging info
 */
public ChargePane() {
  Gauge socGauge = GaugeBuilder.create().skinType(SkinType.BATTERY).title("SOC")
      .titleColor(Color.WHITE).animated(true).gradientBarEnabled(true)
      .minValue(0)
      .maxValue(100)
      .tickLabelDecimals(1)
      .decimals(1)
      //.title(I18n.get(I18n.SOC))
      .titleColor(Color.WHITE)
      .gradientBarStops(new Stop(0.0, Color.RED),
          new Stop(0.25, Color.ORANGE), new Stop(0.50, Color.YELLOW),
          new Stop(0.75, Color.YELLOWGREEN), new Stop(1.0, Color.LIME))
      .build();

  super.addGauge("SOC",socGauge,0,0);
  super.addGauge("Range",I18n.RR,I18n.KM,1,0).setDecimals(1);
  super.addGauge("BatteryCapacity", I18n.BATTERY_CAPACITY,I18n.AH, 2,0).setDecimals(1);
  super.addGauge("ACPower",I18n.AC_POWER,I18n.K_WATT,0,1).setDecimals(1);
  super.addGauge("ACVolts",I18n.AC_VOLTS,I18n.VOLTS,1,1);
  super.addGauge("ACAmps",I18n.AC_AMPS,I18n.AMPS,2,1).setDecimals(1);;
  super.addGauge("DCPower",I18n.DC_POWER,I18n.K_WATT,0,2).setDecimals(1);    
  super.addGauge("DCVolts",I18n.DC_VOLTS,I18n.VOLTS,1,2);
  super.addGauge("DCAmps",I18n.DC_AMPS,I18n.AMPS,2,2).setDecimals(1);;    
  this.fixColumnSizes(4, 33,33,33);
  this.fixRowSizes(4, 33,33,33);
}
项目:WholesomeChat    文件:MainController.java   
@SuppressWarnings("unchecked")
private void createToneChart(List<ChartData> list) {
    if (tile != null) {
        anchor.getChildren().remove(tile);
        tile = null;
    }

    List<ChartData> emptyList = new ArrayList<ChartData>();
    for(int i = 0; i < list.size(); i++) {
        emptyList.add(new ChartData(0));
    }

    tile = TileBuilder.create().skinType(SkinType.RADAR_CHART)
               .prefSize(310, 410)
               .layoutX(490)
               .layoutY(15)
               .minValue(0)
               .maxValue(100)
               //.title("RadarChart Tile")
               .unit("Tones")
               .radarChartMode(Mode.POLYGON)
               .gradientStops(new Stop(0.00000, Color.TRANSPARENT),
                              new Stop(0.00001, Color.web("#3552a0")),
                              new Stop(0.09090, Color.web("#456acf")),
                              new Stop(0.27272, Color.web("#45a1cf")),
                              new Stop(0.36363, Color.web("#30c8c9")),
                              new Stop(0.45454, Color.web("#30c9af")),
                              new Stop(0.50909, Color.web("#56d483")),
                              new Stop(0.72727, Color.web("#9adb49")),
                              new Stop(0.81818, Color.web("#efd750")),
                              new Stop(0.90909, Color.web("#ef9850")),
                              new Stop(1.00000, Color.web("#ef6050")))
               //.text("Sector")
               .tooltipText("")
               .chartData(emptyList)
               .animated(true)
               .build();
    emptyList = tile.getChartData();
    for (int i = 0; i < list.size(); i++) {
        emptyList.get(i).setName(list.get(i).getName());
        emptyList.get(i).setValue(list.get(i).getValue());
    }
    anchor.getChildren().add(tile);
}
项目: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);
}