本文整理汇总了Java中javafx.scene.effect.ColorAdjust.setSaturation方法的典型用法代码示例。如果您正苦于以下问题:Java ColorAdjust.setSaturation方法的具体用法?Java ColorAdjust.setSaturation怎么用?Java ColorAdjust.setSaturation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.effect.ColorAdjust
的用法示例。
在下文中一共展示了ColorAdjust.setSaturation方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LoadingProgressDisplay
import javafx.scene.effect.ColorAdjust; //导入方法依赖的package包/类
/**
* Creates a UI display monitor for provided worker.
*
* Assumes the worker is reporting progress as work done on a scale from 0 to 100 (other values indicate indeterminate progress).
*
* @param worker the worker whose progress is to be monitored and displayed.
*/
public LoadingProgressDisplay(Worker worker) {
setMaxWidth(Double.MAX_VALUE);
ColorAdjust bleach = new ColorAdjust();
bleach.setSaturation(-0.6);
setEffect(bleach);
HBox.setHgrow(this, Priority.ALWAYS);
visibleProperty().bind(worker.runningProperty());
// as the webview load progresses update progress.
worker.workDoneProperty().addListener((observableValue, oldNumber, newNumber) -> {
if (newNumber == null) newNumber = -1.0;
final double newValue = newNumber.doubleValue();
if (newValue < 0.0 || newValue > 100.0) {
setProgress(ProgressBar.INDETERMINATE_PROGRESS);
}
setProgress(newValue / 100.0);
});
}
示例2: createTargetButton
import javafx.scene.effect.ColorAdjust; //导入方法依赖的package包/类
private void createTargetButton() {
target = (StackPane) lookup("#targetAnchor");
Image image = IconFactory.getTargetIcon();
ImageView targetIcon = new ImageView(image);
targetIcon.setClip(new ImageView(image));
ColorAdjust monochrome = new ColorAdjust();
monochrome.setSaturation(-1.0);
Blend red = new Blend(BlendMode.MULTIPLY, monochrome,
new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), Color.RED));
Blend green = new Blend(BlendMode.MULTIPLY, monochrome,
new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), new Color(0, 1, 0, 0.5)));
targetButton = targetIcon;
targetIcon.effectProperty().bind(Bindings.when(targetButton.hoverProperty()).then((Effect) green).otherwise((Effect) red));
targetButton.setId("target_button");
hideTargetMarker();
target.getChildren().add(targetButton);
}
示例3: applyFontColor
import javafx.scene.effect.ColorAdjust; //导入方法依赖的package包/类
private static void applyFontColor(ImageView image, Color color) {
ColorAdjust monochrome = new ColorAdjust();
monochrome.setSaturation(-1.0);
Effect colorInput = new ColorInput(0, 0, image.getImage().getWidth(), image.getImage().getHeight(), color);
Blend blend = new Blend(BlendMode.MULTIPLY, new ImageInput(image.getImage()), colorInput);
image.setClip(new ImageView(image.getImage()));
image.setEffect(blend);
image.setCache(true);
}
示例4: createRequiredDecorations
import javafx.scene.effect.ColorAdjust; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Collection<Decoration> createRequiredDecorations(Control target) {
ImageView imageView = new ImageView(REQUIRED_IMAGE);
// The following code will transform REQUIRED_IMAGE from red to blue.
ColorAdjust adjust = new ColorAdjust();
adjust.setSaturation(-1);
Blend bluemaker = new Blend(BlendMode.SRC_ATOP, adjust,
new ColorInput(0, 0, imageView.getImage().getWidth(),
imageView.getImage().getHeight(), Color.DEEPSKYBLUE));
imageView.setEffect(bluemaker);
return Arrays.asList(new GraphicDecoration(imageView, Pos.TOP_LEFT,
REQUIRED_IMAGE.getWidth() / 2, REQUIRED_IMAGE.getHeight() / 2));
}
示例5: colorize
import javafx.scene.effect.ColorAdjust; //导入方法依赖的package包/类
/**
* Given a monochrome image, apply a color to it
*
* @param imageView A view to the target monochrome image
* @param color Target new image color
*/
public static void colorize(final ImageView imageView, final Paint color) {
final ColorAdjust monochrome = new ColorAdjust();
monochrome.setSaturation(-1.0);
monochrome.setBrightness(0.75);
final Blend selectionColorBlend = new Blend(BlendMode.SRC_ATOP,
monochrome, new ColorInput(0, 0, imageView.getFitWidth(),
imageView.getFitHeight(), color));
imageView.setEffect(selectionColorBlend);
}
示例6: updateImageAdjustments
import javafx.scene.effect.ColorAdjust; //导入方法依赖的package包/类
private void updateImageAdjustments() {
double hue = Double.parseDouble(hueValue.getText());
double saturation = Double.parseDouble(saturationValue.getText());
double brightness = Double.parseDouble(brightnessValue.getText());
double contrast = Double.parseDouble(contrastValue.getText());
imageAdjustments = new ColorAdjust();
imageAdjustments.setContrast(contrast);
imageAdjustments.setBrightness(brightness);
imageAdjustments.setHue(hue);
imageAdjustments.setSaturation(saturation);
sourceImageView.setEffect(imageAdjustments);
}
示例7: PromptHandler
import javafx.scene.effect.ColorAdjust; //导入方法依赖的package包/类
public PromptHandler(
String message,
String defaultValue,
EventHandler<ActionEvent> submitHandler,
EventHandler<ActionEvent> cancelHandler
) {
super(14);
// add controls to the popup.
final Label promptMessage = new Label(message);
promptMessage.setWrapText(true);
final ImageView promptImage = new ImageView(ResourceUtil.getImage("help_64.png"));
promptImage.setFitHeight(32);
promptImage.setPreserveRatio(true);
promptMessage.setGraphic(promptImage);
promptMessage.setPrefWidth(350);
final TextField inputField = new TextField(defaultValue);
inputField.setTranslateY(-5);
Platform.runLater(inputField::selectAll);
// action button text setup.
HBox buttonBar = new HBox(20);
final Button submitButton = new Button(getString("dialog.submit"));
submitButton.setDefaultButton(true);
final Button cancelButton = new Button(getString("dialog.cancel"));
cancelButton.setCancelButton(true);
ColorAdjust bleach = new ColorAdjust();
bleach.setSaturation(-0.6);
cancelButton.setEffect(bleach);
buttonBar.getChildren().addAll(submitButton, cancelButton);
// layout the popup.
setPadding(new Insets(10));
getStyleClass().add("alert-dialog");
getChildren().addAll(promptMessage, inputField, buttonBar);
final DropShadow dropShadow = new DropShadow();
setEffect(dropShadow);
// submit and close the popup.
submitButton.setOnAction(submitHandler);
// submit and close the popup.
cancelButton.setOnAction(cancelHandler);
}