本文整理汇总了Java中javafx.scene.shape.Shape.getStroke方法的典型用法代码示例。如果您正苦于以下问题:Java Shape.getStroke方法的具体用法?Java Shape.getStroke怎么用?Java Shape.getStroke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Shape
的用法示例。
在下文中一共展示了Shape.getStroke方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: strokeFrom
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
/**
* Animates the element's border color from the given rotation to the existing one. CAN ONLY BE APPLIED TO SHAPES.
* @param duration Duration of the animation
* @param color The color to animate from
*/
public Sprint strokeFrom(double duration, Color color) {
KeyValue keyValueX;
if (node instanceof Shape) {
Shape shape = (Shape) node;
keyValueX = new KeyValue(shape.strokeProperty(), shape.getStroke(), interpolator);
shape.setStroke(color);
} else {
return this;
}
KeyFrame keyFrame = new KeyFrame(Duration.seconds(duration), keyValueX);
timeline.getKeyFrames().add(keyFrame);
return this;
}
示例2: accept
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
@Override
public boolean accept(Node node)
{
if (node instanceof Shape)
{
Shape shape = (Shape) node;
if (result == null) result = shape.getStroke();
shape.setStroke(paint);
}
if (node instanceof Text)
{
Text text = (Text) node;
text.setFill(paint);
}
return true;
}
示例3: addStrokeDataFromShape
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private static void addStrokeDataFromShape(SvgNodeProperties properties, Shape shape) {
//color
Paint stroke = shape.getStroke();
String strokeColor = paintToColorString(stroke);
properties.setStroke(strokeColor);
//width
Double strokeWidth = shape.getStrokeWidth();
properties.setStrokeWidth(strokeWidth);
//line cap
StrokeLineCap strokeLineCap = shape.getStrokeLineCap();
properties.setStrokeLineCap(strokeLineCap);
//dash array
List<Double> strokeDashArrayList = shape.getStrokeDashArray();
String strokeDashArray = doubleArrayToStrokeDashArrayString(strokeDashArrayList);
properties.setStrokeDashArray(strokeDashArray);
//dash offset
Double strokeDashOffset = shape.getStrokeDashOffset();
properties.setStrokeDashOffset(strokeDashOffset);
//line join
StrokeLineJoin strokeLineJoin = shape.getStrokeLineJoin();
properties.setStrokeLineJoin(strokeLineJoin);
//miter limit
Double strokeMiterLimit = shape.getStrokeMiterLimit();
properties.setStrokeMiterLimit(strokeMiterLimit);
//alignment
StrokeType strokeType = shape.getStrokeType();
properties.setStrokeAlignment(strokeType);
}