类javafx.scene.effect.Effect源码实例Demo

下面列出了怎么用javafx.scene.effect.Effect的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: PDF4Teachers   文件: Builders.java
public static ImageView buildImage(String imgPath, int width, int height, Effect effect) {
    ImageView imageView = new ImageView(new Image(imgPath));

    if(effect != null) imageView.setEffect(effect);

    if(width == 0 && height == 0) return imageView;

    if(width == 0){
        imageView.setFitHeight(height);
        imageView.setPreserveRatio(true);
    }else if(height == 0){
        imageView.setFitWidth(width);
        imageView.setPreserveRatio(true);
    }else{
        imageView.setFitWidth(width);
        imageView.setFitHeight(height);
    }
    return imageView;
}
 
源代码2 项目: Learn-Java-12-Programming   文件: OtherEffects.java
@Override
public void run(){
    try {
        for(String effect: effects){
            for(int i = 0; i < 11; i++){
                double d = Math.round(i * 0.1 * 10.0) / 10.0;
                Effect e = createEffect(effect, i, txt);
                ivM.setEffect(e);
                ivP.setEffect(e);
                TimeUnit.SECONDS.sleep(1);
                if(pause){
                    while(true){
                        TimeUnit.SECONDS.sleep(1);
                        if(!pause){
                            break;
                        }
                    }
                }
            }
        }
        Platform.exit();
    } catch (Exception ex){
        ex.printStackTrace();
    }
}
 
源代码3 项目: gef   文件: GeometryNodeSnippet.java
protected static Effect createShadowEffect() {
	final DropShadow outerShadow = new DropShadow();
	outerShadow.setRadius(3);
	outerShadow.setSpread(0.2);
	outerShadow.setOffsetX(3);
	outerShadow.setOffsetY(3);
	outerShadow.setColor(new Color(0.3, 0.3, 0.3, 1));

	final Distant light = new Distant();
	light.setAzimuth(-135.0f);

	final Lighting l = new Lighting();
	l.setLight(light);
	l.setSurfaceScale(3.0f);

	final Blend effects = new Blend(BlendMode.MULTIPLY);
	effects.setTopInput(l);
	effects.setBottomInput(outerShadow);

	return effects;
}
 
源代码4 项目: gef   文件: MvcLogoExample.java
private static Effect createShadowEffect() {
	DropShadow outerShadow = new DropShadow();
	outerShadow.setRadius(3);
	outerShadow.setSpread(0.2);
	outerShadow.setOffsetX(3);
	outerShadow.setOffsetY(3);
	outerShadow.setColor(new Color(0.3, 0.3, 0.3, 1));

	Distant light = new Distant();
	light.setAzimuth(-135.0f);

	Lighting l = new Lighting();
	l.setLight(light);
	l.setSurfaceScale(3.0f);

	Blend effects = new Blend(BlendMode.MULTIPLY);
	effects.setTopInput(l);
	effects.setBottomInput(outerShadow);

	return effects;
}
 
源代码5 项目: FxDock   文件: FxIconBuilder.java
protected Effect setInputEffect(Effect a, Effect b)
{
	// I don't know a better way to chain effects, it's missing in FX
	// https://bugs.openjdk.java.net/browse/JDK-8091895
	// perhaps try Blend:
	// https://community.oracle.com/thread/2337194?tstart=0
	if(b instanceof GaussianBlur)
	{
		((GaussianBlur)b).setInput(a);
	}
	else if(b instanceof ColorAdjust)
	{
		((ColorAdjust)b).setInput(a);
	}
	else
	{
		throw new Error("todo: does " + b + " have setInput()?"); 
	}
	return b;
}
 
源代码6 项目: metastone   文件: GameToken.java
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);
}
 
源代码7 项目: paintera   文件: NameField.java
public NameField(final String name, final String prompt, final Effect errorEffect)
{
	this.nameField = new TextField("");
	this.nameField.setPromptText(prompt);
	this.errorEffect = errorEffect;
	this.noErrorEffect = this.nameField.getEffect();
	this.errorString = name + " not specified!";
	this.errorMessage = new SimpleObjectProperty<>(errorString);
	this.nameField.textProperty().addListener((obs, oldv, newv) -> {
		final boolean isError = Optional.ofNullable(newv).orElse("").length() > 0;
		this.errorMessage.set(!isError ? errorString : "");
		this.effectProperty.set(!isError ? this.errorEffect : noErrorEffect);
	});

	this.effectProperty.addListener((obs, oldv, newv) -> {
		if (!nameField.isFocused())
			nameField.setEffect(newv);
	});

	nameField.setEffect(this.effectProperty.get());

	nameField.focusedProperty().addListener((obs, oldv, newv) -> {
		if (newv)
			nameField.setEffect(this.noErrorEffect);
		else
			nameField.setEffect(effectProperty.get());
	});

	this.nameField.setText(null);

}
 
源代码8 项目: marathonv5   文件: DigitalClock.java
public Digit(Color onColor, Color offColor, Effect onEffect, Effect offEffect) {
    this.onColor = onColor;
    this.offColor = offColor;
    this.onEffect = onEffect;
    this.offEffect = offEffect;
    getChildren().addAll(polygons);
    getTransforms().add(new Shear(-0.1,0));
    showNumber(0);
}
 
源代码9 项目: marathonv5   文件: DigitalClock.java
public Digit(Color onColor, Color offColor, Effect onEffect, Effect offEffect) {
    this.onColor = onColor;
    this.offColor = offColor;
    this.onEffect = onEffect;
    this.offEffect = offEffect;
    getChildren().addAll(polygons);
    getTransforms().add(new Shear(-0.1,0));
    showNumber(0);
}
 
源代码10 项目: netbeans   文件: DigitalClock.java
public Digit(Color onColor, Color offColor, Effect onEffect, Effect offEffect) {
    this.onColor = onColor;
    this.offColor = offColor;
    this.onEffect = onEffect;
    this.offEffect = offEffect;
    getChildren().addAll(polygons);
    getTransforms().add(new Shear(-0.1,0));
    showNumber(0);
}
 
源代码11 项目: gef   文件: AbstractGeometricElement.java
public AbstractGeometricElement(G geometry, AffineTransform transform,
		Paint stroke, double strokeWidth, Effect effect) {
	this(geometry);
	setTransform(transform);
	setEffect(effect);
	setStroke(stroke);
	setStrokeWidth(strokeWidth);
}
 
源代码12 项目: gef   文件: AbstractGeometricElement.java
public AbstractGeometricElement(G geometry, Paint stroke,
		double strokeWidth, Effect effect) {
	setGeometry(geometry);
	setEffect(effect);
	setStroke(stroke);
	setStrokeWidth(strokeWidth);
}
 
源代码13 项目: gef   文件: GeometricCurve.java
public GeometricCurve(Point[] waypoints, Paint stroke, double strokeWidth, Double[] dashes, Effect effect) {
	super(constructCurveFromWayPoints(waypoints), stroke, strokeWidth, effect);
	if (waypoints.length < 2) {
		throw new IllegalArgumentException("At least start and end point need to be specified,");
	}
	wayPointsProperty.addAll(Arrays.asList(waypoints));
	dashesProperty.addAll(dashes);
}
 
源代码14 项目: FxDock   文件: FxIconBuilder.java
public void addEffect(Effect x)
{
	if(effect == null)
	{
		effect = x;
	}
	else
	{
		effect = setInputEffect(effect, x);
	}
}
 
源代码15 项目: metastone   文件: DigitFactory.java
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);
}
 
源代码16 项目: narjillos   文件: ThingView.java
private Effect getHaloEffect(double zoomLevel) {
	double minZoomLevel = 0.2;
	if (zoomLevel <= minZoomLevel)
		return null;
	double alpha = (zoomLevel - minZoomLevel) * 2.5;
	double limitedAlpha = Math.max(0, Math.min(1, alpha));
	Color color = new Color(0.9, 0.9, 0.9, limitedAlpha);
	return new DropShadow(20, 7, 7, color);
}
 
源代码17 项目: CrazyAlpha   文件: BaseModel.java
public Effect getEffect() {
    return effect;
}
 
源代码18 项目: CrazyAlpha   文件: BaseModel.java
public void setEffect(Effect effect) {
    this.effect = effect;
}
 
源代码19 项目: DeskChan   文件: Sprite.java
public void applyEffect(Effect effect){
    this.effect = effect;
    sprite.setEffect(null);
    sprite.setEffect(effect);
}
 
源代码20 项目: gef   文件: AbstractGeometricElement.java
public Effect getEffect() {
	return effect;
}
 
源代码21 项目: gef   文件: AbstractGeometricElement.java
public void setEffect(Effect effect) {
	this.effect = effect;
}
 
源代码22 项目: gef   文件: GeometricShape.java
public GeometricShape(IShape shape, AffineTransform transform, Color stroke, double strokeWidth, Paint fill,
		Effect effect) {
	super(shape, transform, stroke, strokeWidth, effect);
	setFill(fill);
}
 
源代码23 项目: gef   文件: GeometricShape.java
public GeometricShape(IShape shape, AffineTransform transform, Paint fill, Effect effect) {
	this(shape, transform, new Color(0, 0, 0, 1), 1.0, fill, effect);
}
 
源代码24 项目: FxDock   文件: FxIconBuilder.java
public void setEffect(Effect x)
{
	effect = x;
}
 
源代码25 项目: narjillos   文件: EnvironmentView.java
private Effect getBlurEffect(double zoomLevel) {
	int blurAmount = Math.min((int) (15 * (zoomLevel - 0.7)), 10);
	return new BoxBlur(blurAmount, blurAmount, 1);
}
 
源代码26 项目: narjillos   文件: ThingView.java
Effect getEffects(double zoomLevel, boolean infraredOn) {
	if (infraredOn)
		return getHaloEffect(zoomLevel * 1.5);

	return getHaloEffect(zoomLevel);
}
 
源代码27 项目: gef   文件: HoverBehavior.java
/**
 * Returns the {@link Effect} that is applied to {@link IHandlePart}s as a
 * replacement for {@link IFeedbackPart}s which are created for normal
 * parts.
 *
 * @param contextMap
 *            A map with context information that might be needed to
 *            identify the concrete creation context.
 * @return The {@link Effect} that is applied to {@link IHandlePart}s as a
 *         replacement for {@link IFeedbackPart}s which are created for
 *         normal parts.
 */
public Effect getHandleHoverFeedbackEffect(Map<Object, Object> contextMap) {
	DropShadow effect = new DropShadow();
	effect.setRadius(5);
	return effect;
}
 
源代码28 项目: gef   文件: HoverFeedbackPart.java
/**
 * Returns the {@link Effect} that is provided by the
 * <code>Provider&lt;Effect&gt;</code> of this part's first anchorage.
 *
 * @return The {@link Effect} that is provided by the
 *         <code>Provider&lt;Effect&gt;</code> of this part's first
 *         anchorage.
 */
public Effect getHoverFeedbackEffect() {
	DropShadow effect = new DropShadow();
	effect.setRadius(3);
	return effect;
}
 
 类所在包
 同包方法