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


Java ColorInput类代码示例

本文整理汇总了Java中javafx.scene.effect.ColorInput的典型用法代码示例。如果您正苦于以下问题:Java ColorInput类的具体用法?Java ColorInput怎么用?Java ColorInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: drawNode

import javafx.scene.effect.ColorInput; //导入依赖的package包/类
@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(Color.RED);
    effect.setX(15);
    effect.setY(15);
    effect.setWidth(70);
    effect.setHeight(70);

    gc.applyEffect(effect);
    return group;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:CanvasEffects2App.java

示例2: createTargetButton

import javafx.scene.effect.ColorInput; //导入依赖的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);
}
 
开发者ID:demilich1,项目名称:metastone,代码行数:22,代码来源:GameToken.java

示例3: applyFontColor

import javafx.scene.effect.ColorInput; //导入依赖的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);
}
 
开发者ID:demilich1,项目名称:metastone,代码行数:10,代码来源:DigitFactory.java

示例4: createRequiredDecorations

import javafx.scene.effect.ColorInput; //导入依赖的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));
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:17,代码来源:CuteGraphicValidationDecoration.java

示例5: colorize

import javafx.scene.effect.ColorInput; //导入依赖的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);			
}
 
开发者ID:veroslav,项目名称:jfx-torrent,代码行数:17,代码来源:ImageUtils.java

示例6: getOverlayImage

import javafx.scene.effect.ColorInput; //导入依赖的package包/类
/**
 * Retrieve an overlay image.
 *
 * @param overlayType
 *            The overlay type.
 * @param side
 *            The side of the eye.
 * @param color
 *            The overlay color.
 *
 * @return The overlay image.
 */
private static Image getOverlayImage(final int overlayType, final RightLeft side, final Color color) {
	URL imageUrl = ClassLoader.getSystemResource("overlay/" + getOverlayFileName(overlayType, side));

	Image image = new Image(imageUrl.toExternalForm());

	Canvas canvas = new Canvas(OVERLAY_SIZE, OVERLAY_SIZE);
	Color colorNoAlpha = new Color(color.getRed(), color.getGreen(), color.getBlue(), 1);

	Blend effect = new Blend(
			BlendMode.SRC_ATOP,
			null,
			new ColorInput(
					0,
					0,
					OVERLAY_SIZE,
					OVERLAY_SIZE,
					colorNoAlpha));

	// Type 2 is not changed in color.
	if (overlayType != 2) {
		canvas.getGraphicsContext2D().setEffect(effect);
	}
	canvas.getGraphicsContext2D().setGlobalAlpha(color.getOpacity());
	canvas.getGraphicsContext2D().drawImage(image, 0, 0, OVERLAY_SIZE, OVERLAY_SIZE);
	SnapshotParameters parameters = new SnapshotParameters();
	parameters.setFill(Color.TRANSPARENT);

	return canvas.snapshot(parameters, null);
}
 
开发者ID:jeisfeld,项目名称:Augendiagnose,代码行数:42,代码来源:ImageUtil.java

示例7: HasLocationPortrait

import javafx.scene.effect.ColorInput; //导入依赖的package包/类
protected HasLocationPortrait(EconomicAgent agent, DoubleProperty xLocationProperty,
                              DoubleProperty yLocationProperty)
{
    this.agent =agent;
    this.xLocationProperty = xLocationProperty;
    this.yLocationProperty = yLocationProperty;

    nodeDelegate = new GUINodeSimple();

    //load the image
    icon = new ImageView();
    icon.setImage(initImage(agent));
    this.getChildren().add(icon);
    //bind icon height to pref-height. The idea here is that when they resize this region, we resize the location portrait as well
    icon.fitWidthProperty().bind(prefWidthProperty());
    icon.fitHeightProperty().bind(prefHeightProperty());


    //this is to keep it with the right color
    ColorAdjust monochrome = new ColorAdjust(); //this is the first effect
    //monochrome.setBrightness(-1.0);
    //keep the color
    color= new SimpleObjectProperty<>(Color.BLACK);


    ColorInput input = new ColorInput(); //this is the second effect, the coloring proper
    input.setX(0); input.setY(0);
    input.widthProperty().bind(prefWidthProperty());
    input.heightProperty().bind(prefHeightProperty());

    input.paintProperty().bind(color);

    //bind the color adjust
    Blend coloring = new Blend(BlendMode.SRC_ATOP,monochrome,input);
    icon.effectProperty().setValue(coloring);

    setCache(true);
    setCacheHint(CacheHint.SPEED);


    //now set the text
    priceText = new Text();
    this.getChildren().add(priceText );
    priceText.setFont(Font.font("Verdana", 10));

    priceText.setFill(Color.BLACK);



}
 
开发者ID:CarrKnight,项目名称:MacroIIDiscrete,代码行数:51,代码来源:HasLocationPortrait.java


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