由于您不关心它是矢量形状还是位图,我将在此处使用位图概述解决方案.如果你真的想要一个矢量形状,我相信你需要使用矢量输入来获得一个好的结果.
使用ColorAdjust效果,亮度设置为最小(-1).
缓存SPEED的结果.
这是一个创建图像阴影轮廓的示例:
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.effect.ColorAdjust;
import javafx.scene.image.*;
import javafx.stage.Stage;
public class Shadow extends Application {
@Override
public void start(Stage stage) throws Exception {
ImageView imageView = new ImageView(
new Image(
"http://i.stack.imgur.com/jbT1H.png"
)
);
ColorAdjust blackout = new ColorAdjust();
blackout.setBrightness(-1.0);
imageView.setEffect(blackout);
imageView.setCache(true);
imageView.setCacheHint(CacheHint.SPEED);
stage.setScene(new Scene(new Group(imageView)));
stage.show();