Java Code Examples for javafx.scene.effect.ColorAdjust#setSaturation()

The following examples show how to use javafx.scene.effect.ColorAdjust#setSaturation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigController.java    From houdoku with MIT License 6 votes vote down vote up
/**
 * Update the page effect/filter preview using the slider values.
 * 
 * <p>This method also updates the labels next to each slider.
 */
@FXML
private void updateEffectPreview() {
    ColorAdjust color_adjust = new ColorAdjust();
    double hue = filterHueSlider.getValue();
    double saturation = filterSaturationSlider.getValue();
    double brightness = filterBrightnessSlider.getValue();

    if (effectColorCheck.isSelected()) {
        filterHueSliderLabel.setText(String.format("%.2f", hue));
        color_adjust.setHue(hue);
        color_adjust.setSaturation(filterSaturationSlider.getValue());

        filterSaturationSliderLabel.setText(String.format("%.2f", saturation));
        color_adjust.setSaturation(saturation);
        color_adjust.setHue(filterHueSlider.getValue());
    }
    if (effectBrightnessCheck.isSelected()) {
        filterBrightnessSliderLabel.setText(String.format("%.2f", brightness));
        color_adjust.setBrightness(brightness);
    }

    effectPreview.setEffect(color_adjust);
}
 
Example 2
Source File: GameToken.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: BytecodeEditorPane.java    From Recaf with MIT License 5 votes vote down vote up
/**
 * Called by the error handler to notify the UI of error status.
 *
 * @param exceptions
 * 		Errors reported.
 */
public void onErrorsReceived(List<LineException> exceptions) {
	if (exceptions == null || exceptions.isEmpty()) {
		ColorAdjust colorAdjust = new ColorAdjust();
		colorAdjust.setBrightness(-0.7);
		colorAdjust.setSaturation(-0.8);
		errorGraphic.setEffect(colorAdjust);
	} else {
		errorGraphic.setEffect(null);
		stackHelper.setErrored();
	}
}
 
Example 4
Source File: IconsListElementSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Updates grayscale of the miniature when the enabled state has been updated
 *
 * @param miniature The miniature
 */
private void updateEnabled(final Region miniature) {
    if (!getControl().isEnabled()) {
        final ColorAdjust grayScale = new ColorAdjust();
        grayScale.setSaturation(-1);

        miniature.setEffect(grayScale);
    } else {
        miniature.setEffect(null);
    }
}
 
Example 5
Source File: DigitFactory.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
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);
}