本文整理匯總了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);
}