当前位置: 首页>>代码示例>>Java>>正文


Java Stop.getOffset方法代码示例

本文整理汇总了Java中javafx.scene.paint.Stop.getOffset方法的典型用法代码示例。如果您正苦于以下问题:Java Stop.getOffset方法的具体用法?Java Stop.getOffset怎么用?Java Stop.getOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.paint.Stop的用法示例。


在下文中一共展示了Stop.getOffset方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ladder

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:HeatTabController.java

示例2: getColor

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
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));
}
 
开发者ID:lsinfo3,项目名称:mo-vnfcp,代码行数:19,代码来源:GuiApp.java

示例3: interpolateColor

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
private Color interpolateColor(final Stop LOWER_BOUND, final Stop UPPER_BOUND, final double POSITION) {
    final double POS  = (POSITION - LOWER_BOUND.getOffset()) / (UPPER_BOUND.getOffset() - LOWER_BOUND.getOffset());

    final double DELTA_RED     = (UPPER_BOUND.getColor().getRed()     - LOWER_BOUND.getColor().getRed())     * POS;
    final double DELTA_GREEN   = (UPPER_BOUND.getColor().getGreen()   - LOWER_BOUND.getColor().getGreen())   * POS;
    final double DELTA_BLUE    = (UPPER_BOUND.getColor().getBlue()    - LOWER_BOUND.getColor().getBlue())    * POS;
    final double DELTA_OPACITY = (UPPER_BOUND.getColor().getOpacity() - LOWER_BOUND.getColor().getOpacity()) * POS;

    double red     = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getRed() + DELTA_RED));
    double green   = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getGreen()   + DELTA_GREEN));
    double blue    = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getBlue()    + DELTA_BLUE));
    double opacity = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getOpacity() + DELTA_OPACITY));

    return Color.color(red, green, blue, opacity);
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:16,代码来源:GradientLookup.java

示例4: interpolateColor

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
private Color interpolateColor(final Stop LOWER_BOUND, final Stop UPPER_BOUND, final double POSITION) {
    final double POS = (POSITION - LOWER_BOUND.getOffset()) / (UPPER_BOUND.getOffset() - LOWER_BOUND.getOffset());

    final double DELTA_RED     = (UPPER_BOUND.getColor().getRed()     - LOWER_BOUND.getColor().getRed())     * POS;
    final double DELTA_GREEN   = (UPPER_BOUND.getColor().getGreen()   - LOWER_BOUND.getColor().getGreen())   * POS;
    final double DELTA_BLUE    = (UPPER_BOUND.getColor().getBlue()    - LOWER_BOUND.getColor().getBlue())    * POS;
    final double DELTA_OPACITY = (UPPER_BOUND.getColor().getOpacity() - LOWER_BOUND.getColor().getOpacity()) * POS;

    double red     = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getRed() + DELTA_RED));
    double green   = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getGreen()   + DELTA_GREEN));
    double blue    = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getBlue()    + DELTA_BLUE));
    double opacity = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getOpacity() + DELTA_OPACITY));

    return Color.color(red, green, blue, opacity);
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:16,代码来源:GradientLookup.java

示例5: interpolateColor

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
public static final Color interpolateColor(final Stop LOWER_BOUND, final Stop UPPER_BOUND, final double POSITION) {
    final double POS  = (POSITION - LOWER_BOUND.getOffset()) / (UPPER_BOUND.getOffset() - LOWER_BOUND.getOffset());

    final double DELTA_RED     = (UPPER_BOUND.getColor().getRed()     - LOWER_BOUND.getColor().getRed())     * POS;
    final double DELTA_GREEN   = (UPPER_BOUND.getColor().getGreen()   - LOWER_BOUND.getColor().getGreen())   * POS;
    final double DELTA_BLUE    = (UPPER_BOUND.getColor().getBlue()    - LOWER_BOUND.getColor().getBlue())    * POS;
    final double DELTA_OPACITY = (UPPER_BOUND.getColor().getOpacity() - LOWER_BOUND.getColor().getOpacity()) * POS;

    double red     = clamp(0, 1, (LOWER_BOUND.getColor().getRed()     + DELTA_RED));
    double green   = clamp(0, 1, (LOWER_BOUND.getColor().getGreen()   + DELTA_GREEN));
    double blue    = clamp(0, 1, (LOWER_BOUND.getColor().getBlue()    + DELTA_BLUE));
    double opacity = clamp(0, 1, (LOWER_BOUND.getColor().getOpacity() + DELTA_OPACITY));

    return Color.color(red, green, blue, opacity);
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:16,代码来源:Helper.java

示例6: interpolateColor

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
private Color interpolateColor(final Stop LOWER_BOUND, final Stop UPPER_BOUND, final double POSITION) {
    final double POS  = (POSITION - LOWER_BOUND.getOffset()) / (UPPER_BOUND.getOffset() - LOWER_BOUND.getOffset());

    final double DELTA_RED     = (UPPER_BOUND.getColor().getRed()     - LOWER_BOUND.getColor().getRed())     * POS;
    final double DELTA_GREEN   = (UPPER_BOUND.getColor().getGreen()   - LOWER_BOUND.getColor().getGreen())   * POS;
    final double DELTA_BLUE    = (UPPER_BOUND.getColor().getBlue()    - LOWER_BOUND.getColor().getBlue())    * POS;
    final double DELTA_OPACITY = (UPPER_BOUND.getColor().getOpacity() - LOWER_BOUND.getColor().getOpacity()) * POS;

    double red     = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getRed()     + DELTA_RED));
    double green   = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getGreen()   + DELTA_GREEN));
    double blue    = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getBlue()    + DELTA_BLUE));
    double opacity = Helper.clamp(0.0, 1.0, (LOWER_BOUND.getColor().getOpacity() + DELTA_OPACITY));

    return Color.color(red, green, blue, opacity);
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:16,代码来源:GradientLookup.java

示例7: interpolateColor

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
private Color interpolateColor(final Stop LOWER_BOUND, final Stop UPPER_BOUND, final double POSITION) {
    final double POS = (POSITION - LOWER_BOUND.getOffset()) / (UPPER_BOUND.getOffset() - LOWER_BOUND.getOffset());

    final double DELTA_RED     = (UPPER_BOUND.getColor().getRed()     - LOWER_BOUND.getColor().getRed())     * POS;
    final double DELTA_GREEN   = (UPPER_BOUND.getColor().getGreen()   - LOWER_BOUND.getColor().getGreen())   * POS;
    final double DELTA_BLUE    = (UPPER_BOUND.getColor().getBlue()    - LOWER_BOUND.getColor().getBlue())    * POS;
    final double DELTA_OPACITY = (UPPER_BOUND.getColor().getOpacity() - LOWER_BOUND.getColor().getOpacity()) * POS;

    double red     = clamp(0d, 1d, (LOWER_BOUND.getColor().getRed()     + DELTA_RED));
    double green   = clamp(0d, 1d, (LOWER_BOUND.getColor().getGreen()   + DELTA_GREEN));
    double blue    = clamp(0d, 1d, (LOWER_BOUND.getColor().getBlue()    + DELTA_BLUE));
    double opacity = clamp(0d, 1d, (LOWER_BOUND.getColor().getOpacity() + DELTA_OPACITY));

    return Color.color(red, green, blue, opacity);
}
 
开发者ID:HanSolo,项目名称:MoodFX,代码行数:16,代码来源:GradientLookup.java

示例8: interpolateColor

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
private Color interpolateColor(final Stop LOWER_BOUND, final Stop UPPER_BOUND, final double POSITION) {
    final double POS = (POSITION - LOWER_BOUND.getOffset()) / (UPPER_BOUND.getOffset() - LOWER_BOUND.getOffset());

    final double DELTA_RED     = (UPPER_BOUND.getColor().getRed()     - LOWER_BOUND.getColor().getRed())     * POS;
    final double DELTA_GREEN   = (UPPER_BOUND.getColor().getGreen()   - LOWER_BOUND.getColor().getGreen())   * POS;
    final double DELTA_BLUE    = (UPPER_BOUND.getColor().getBlue()    - LOWER_BOUND.getColor().getBlue())    * POS;
    final double DELTA_OPACITY = (UPPER_BOUND.getColor().getOpacity() - LOWER_BOUND.getColor().getOpacity()) * POS;

    double red     = clamp(0.0, 1.0, (LOWER_BOUND.getColor().getRed()     + DELTA_RED));
    double green   = clamp(0.0, 1.0, (LOWER_BOUND.getColor().getGreen()   + DELTA_GREEN));
    double blue    = clamp(0.0, 1.0, (LOWER_BOUND.getColor().getBlue()    + DELTA_BLUE));
    double opacity = clamp(0.0, 1.0, (LOWER_BOUND.getColor().getOpacity() + DELTA_OPACITY));

    return Color.color(red, green, blue, opacity);
}
 
开发者ID:HanSolo,项目名称:regulators,代码行数:16,代码来源:GradientLookup.java

示例9: interpolateColor

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
private Color interpolateColor(final Stop LOWER_BOUND, final Stop UPPER_BOUND, final double POSITION) {
    final double POS  = (POSITION - LOWER_BOUND.getOffset()) / (UPPER_BOUND.getOffset() - LOWER_BOUND.getOffset());

    final double DELTA_RED     = (UPPER_BOUND.getColor().getRed()     - LOWER_BOUND.getColor().getRed())     * POS;
    final double DELTA_GREEN   = (UPPER_BOUND.getColor().getGreen()   - LOWER_BOUND.getColor().getGreen())   * POS;
    final double DELTA_BLUE    = (UPPER_BOUND.getColor().getBlue()    - LOWER_BOUND.getColor().getBlue())    * POS;
    final double DELTA_OPACITY = (UPPER_BOUND.getColor().getOpacity() - LOWER_BOUND.getColor().getOpacity()) * POS;

    double red     = clamp(0d, 1d, (LOWER_BOUND.getColor().getRed()     + DELTA_RED));
    double green   = clamp(0d, 1d, (LOWER_BOUND.getColor().getGreen()   + DELTA_GREEN));
    double blue    = clamp(0d, 1d, (LOWER_BOUND.getColor().getBlue()    + DELTA_BLUE));
    double opacity = clamp(0d, 1d, (LOWER_BOUND.getColor().getOpacity() + DELTA_OPACITY));

    return Color.color(red, green, blue, opacity);
}
 
开发者ID:HanSolo,项目名称:ColorSelector,代码行数:16,代码来源:GradientLookup.java

示例10: getNewStop

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
private Stop getNewStop ( Stop previous ) {

        Dialog<Stop> dialog = new Dialog<>();

        dialog.setTitle("Stop Editor");
        dialog.setHeaderText(previous == null ? "Define a new Stop" : "Edit the selected Stop");
        dialog.getDialogPane().getButtonTypes().addAll(OK, CANCEL);

        Spinner<Double> offsetSpinner = new Spinner<>(0.0, 1.0, previous == null ? 0.0 : previous.getOffset(), 0.01);
        ColorPicker colorPicker = new ColorPicker(previous == null ? Color.GOLDENROD : previous.getColor());
        GridPane grid = new GridPane();

        offsetSpinner.setEditable(true);
        offsetSpinner.setPrefWidth(USE_COMPUTED_SIZE);
        colorPicker.setPrefWidth(USE_COMPUTED_SIZE);

        grid.setHgap(6);
        grid.setVgap(12);
        grid.setPadding(new Insets(12, 12, 12, 12));
        grid.getColumnConstraints().add(0, new ColumnConstraints(USE_COMPUTED_SIZE, USE_COMPUTED_SIZE, USE_COMPUTED_SIZE, Priority.ALWAYS, HPos.RIGHT, true));
        grid.getColumnConstraints().add(1, new ColumnConstraints(USE_COMPUTED_SIZE, USE_COMPUTED_SIZE, USE_COMPUTED_SIZE, Priority.ALWAYS, HPos.LEFT, true));
        grid.add(new Label("Offset:"), 0, 0);
        grid.add(offsetSpinner, 1, 0);
        grid.add(new Label("Color:"), 0, 1);
        grid.add(colorPicker, 1, 1);

        dialog.initOwner(stopsTable.getScene().getWindow());
        dialog.getDialogPane().getScene().getStylesheets().add("/styles/dark-style.css");
        dialog.getDialogPane().setContent(grid);
        dialog.setResultConverter(b -> {
            if ( b == OK ) {
                return new Stop(offsetSpinner.getValue(), colorPicker.getValue());
            } else {
                return null;
            }
        });

        Platform.runLater(() -> offsetSpinner.requestFocus());

        return dialog.showAndWait().orElse(null);

    }
 
开发者ID:ESSICS,项目名称:KNOBS,代码行数:43,代码来源:StopListEditorController.java

示例11: addPressed

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
@FXML
void addPressed( ActionEvent event ) {

    Stop stop = getNewStop(null);

    if ( stop != null ) {

        boolean done = false;

        for ( int i = 0; i < stopsTable.getItems().size(); i++ ) {
            if ( stopsTable.getItems().get(i).getOffset() > stop.getOffset() ) {

                done = true;

                stopsTable.getItems().add(i, stop);
                break;

            }
        }

        if ( !done ) {
            stopsTable.getItems().add(stop);
        }

    }

}
 
开发者ID:ESSICS,项目名称:KNOBS,代码行数:28,代码来源:StopListEditorController.java

示例12: editPressed

import javafx.scene.paint.Stop; //导入方法依赖的package包/类
@FXML
void editPressed( ActionEvent event ) {

    int index = stopsTable.getSelectionModel().getSelectedIndex();

    Stop stop = getNewStop(stopsTable.getItems().get(index));

    if ( stop != null ) {

        stopsTable.getItems().remove(index);

        boolean done = false;

        for ( int i = 0; i < stopsTable.getItems().size(); i++ ) {
            if ( stopsTable.getItems().get(i).getOffset() > stop.getOffset() ) {

                done = true;

                stopsTable.getItems().add(i, stop);
                break;

            }
        }

        if ( !done ) {
            stopsTable.getItems().add(stop);
        }

    }

}
 
开发者ID:ESSICS,项目名称:KNOBS,代码行数:32,代码来源:StopListEditorController.java


注:本文中的javafx.scene.paint.Stop.getOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。