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


Java SVGPath类代码示例

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


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

示例1: svgPath

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
/** add SVG path */
	public SVGPath svgPath(String svg, boolean autoScale)
	{
		SVGPath p = createSVGPath();
		p.setContent(svg);
		
//		Label r = new Label();
//		r.setGraphic(p);
		elements.add(p);
		
		if(autoScale)
		{
			autoFitLastElement();
		}
		
		return p;
	}
 
开发者ID:andy-goryachev,项目名称:FxEditor,代码行数:18,代码来源:FxIconBuilder.java

示例2: generateOutline

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
/**
 * Once we have drawn the path, we call this method to generate two paths 
 * (outer and inner paths) and get a SVGPath with them that can be exported
 * @param drawPath The original path
 * @param svg
 * @return the content string of the SVGPath with two paths
 */
public boolean generateOutline(Path drawPath, SVGPath svg) {
    Pane pane = (Pane) drawPath.getParent();
    final double width = pane.getWidth() * WIDTH_FACTOR; 
    
    Path outterPath = new Path(drawPath.getElements());
    outterPath.setStroke(drawPath.getStroke());
    outterPath.setStrokeLineJoin(drawPath.getStrokeLineJoin());
    outterPath.setStrokeLineCap(drawPath.getStrokeLineCap());
    outterPath.setStrokeWidth(width);
    Path s1 = (Path) Shape.subtract(outterPath, new Rectangle(0, 0));

    Path innerPath = new Path(drawPath.getElements());
    innerPath.setStrokeWidth(0);
    innerPath.setStroke(drawPath.getStroke());
    innerPath.setStrokeLineJoin(drawPath.getStrokeLineJoin());
    innerPath.setStrokeLineCap(drawPath.getStrokeLineCap());
    Path s2 = (Path) Shape.subtract(innerPath, new Rectangle(0, 0));
    
    Path result = (Path) Shape.subtract(s1, s2);
    clearSmallPolygons(result);
    svg.setContent(pathsToSVGPath());
    return validPaths.size() == 2;
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:31,代码来源:BadgeOutline.java

示例3: drawNode

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
@Override
        public Node drawNode() {
            currentTestNode = this;
            PathTransition pathTransition = new PathTransition();
            Pane p = pre(pathTransition);

            SVGPath path = new SVGPath();
            path.setContent("M40,60 C42,148 144,30 25,32");
            path.setStrokeWidth(2);
            path.setStroke(Color.RED);
            p.getChildren().add(path);
            path.setFill(Color.TRANSPARENT);

//            pathTransition.setDuration(Duration.valueOf(typicalDuration));
            pathTransition.setDuration(new Duration(typicalDuration));
            pathTransition.setNode(circle);
            circle.setRotate(30);
            //pathTransition.setPath(AnimationPath.createFromPath(path));
            pathTransition.setPath(path);
            pathTransition.setOrientation(OrientationType.NONE);

            timeline.setCycleCount(3);
            timeline.setAutoReverse(true);
            return p;
        }
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:26,代码来源:AnimationTransitionApp.java

示例4: Thumbnail

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
@Override
protected Shape[] Thumbnail()
{
	final double thumbSize = 30.0;
	double scaleFactor = thumbSize / Math.max(_pathSize.X, _pathSize.Y);
	SVGPath path = new SVGPath();
	path.setContent(_path);
	
	Translate translate = new Translate();
	translate.setX(thumbSize/2);
	translate.setY(thumbSize/2);

	Scale scale = new Scale();
	scale.setX(scaleFactor);
	scale.setY(scaleFactor);
	scale.setPivotX(0);
	scale.setPivotY(0);

	path.getTransforms().add(translate);
	path.getTransforms().add(scale);
	
	return new Shape[] { path };
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:24,代码来源:OverlayPath.java

示例5: Draw

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double theWidth = GetDoubleAttribute("Width") / MaximumX * canvas.getWidth() / 2;
	double x = canvas.getWidth() * (GetDoubleAttribute("X") / MaximumX);
	
	SVGPath p = new SVGPath();
	p.setContent(String.format("M 0,0 %1$.3f,0 %2$.3f,%3$.3f %4$.3f,%3$.3f %4$.3f,%6$.3f %2$.3f,%6$.3f %1$.3f,%5$.3f 0,%5$.3f 0,%7$.3f %9$.3f,%8$.3f 0,%1$.3f",
			theWidth / 2,
			x + (double)theWidth / 3,
			canvas.getHeight() / 2 - (double)theWidth / 3,
			canvas.getWidth(),
			canvas.getHeight(),
			canvas.getHeight() / 2 + (double)theWidth / 3,
			canvas.getHeight() - (double)theWidth / 2,
			canvas.getHeight() / 2,
			x - (double)theWidth / 3));
	p.setFill(GetColorAttribute("Color"));
	
	canvas.getChildren().add(p);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:22,代码来源:OverlayPall.java

示例6: Draw

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double x1 = canvas.getWidth() * (GetDoubleAttribute("X1") / MaximumX);
	double y1 = canvas.getHeight() * (GetDoubleAttribute("Y1") / MaximumY);
	double x2 = canvas.getWidth() * (GetDoubleAttribute("X2") / MaximumX);
	double y2 = canvas.getHeight() * (GetDoubleAttribute("Y2") / MaximumY);
	double x3 = canvas.getWidth() * (GetDoubleAttribute("X3") / MaximumX);
	double y3 = canvas.getHeight() * (GetDoubleAttribute("Y3") / MaximumY);
	double x4 = canvas.getWidth() * (GetDoubleAttribute("X4") / MaximumX);
	double y4 = canvas.getHeight() * (GetDoubleAttribute("Y4") / MaximumY);

	SVGPath path = new SVGPath();
	path.setContent(String.format("M %.3f,%.3f %.3f,%.3f %.3f,%.3f %.3f,%.3f",
			x1, y1, x2, y2, x3, y3, x4, y4));
	path.setFill(GetColorAttribute("Color"));
	canvas.getChildren().add(path);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:19,代码来源:OverlayQuadrilateral.java

示例7: Draw

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double x1 = canvas.getWidth() * (GetDoubleAttribute("X1") / MaximumX);
	double y1 = canvas.getHeight() * (GetDoubleAttribute("Y1") / MaximumY);
	double x2 = canvas.getWidth() * (GetDoubleAttribute("X2") / MaximumX);
	double y2 = canvas.getHeight() * (GetDoubleAttribute("Y2") / MaximumY);
	double x3 = canvas.getWidth() * (GetDoubleAttribute("X3") / MaximumX);
	double y3 = canvas.getHeight() * (GetDoubleAttribute("Y3") / MaximumY);

	SVGPath path = new SVGPath();
	path.setContent(String.format("M %.3f,%.3f %.3f,%.3f %.3f,%.3f",
			x1, y1, x2, y2, x3, y3));
	path.setFill(GetColorAttribute("Color"));
	canvas.getChildren().add(path);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:17,代码来源:OverlayTriangle.java

示例8: Draw

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double widthX = canvas.getWidth() * (GetDoubleAttribute("Thickness") / MaximumX) / 2;
	double widthY = canvas.getHeight() * (GetDoubleAttribute("Thickness") / MaximumX) / 2;

	SVGPath path1 = new SVGPath();
	SVGPath path2 = new SVGPath();
	
	path1.setContent(String.format("M %1$.3f,0 0,0 0,%2$.3f %3$.3f,%4$.3f %5$.3f,%4$.3f %5$.3f,%6$.3f %1$.3f,0",
			widthX, widthY, canvas.getWidth() - widthX, canvas.getHeight(), canvas.getWidth(), canvas.getHeight() - widthY));
	path2.setContent(String.format("M %1$.3f,0 %2$.3f,0 %2$.3f,%6$.3f %3$.3f,%4$.3f 0,%4$.3f 0,%5$.3f %1$.3f,0",
			canvas.getWidth() - widthX, canvas.getWidth(), widthX, canvas.getHeight(), canvas.getHeight() - widthY, widthY));

	path1.setFill(GetColorAttribute("Color"));
	path2.setFill(GetColorAttribute("Color"));
	
	canvas.getChildren().addAll(path1, path2);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:20,代码来源:OverlaySaltire.java

示例9: initialize

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
private void initialize(double width, double height){
    this.setScaleY(-1);
    this.interval = 1;
    this.currentX = 0;
    this.setMaxWidth(width);
    this.setMaxHeight(height);
    this.setWidth(width);
    this.setHeight(height);
    this.setMinWidth(width);
    this.setMinHeight(height);
    this.points = new ArrayList<>();
    this.isRendered = false;
    this.isNormalized = false;
    this.isManualEntry = false;

    //Unique identification
    this.setId(UUID.randomUUID().toString());

    //Layers
    this.graphPath = new SVGPath();
    this.pointLines = new SVGPath();
    this.pointDots = new Pane();

    //Styling values
    this.smoothing = 0.2;
    this.circleStyle = new Circle();
    this.close = true;
    graphPath.setStrokeWidth(1);
    graphPath.setStroke(BLACK);
    graphPath.setFill(TRANSPARENT);
    graphPath.setStrokeLineJoin(StrokeLineJoin.ROUND);
    pointLines.setStrokeWidth(0.5);
    pointLines.setStroke(BLACK);
    circleStyle.setRadius(2);
    circleStyle.setFill(BLACK);
}
 
开发者ID:DrMerfy,项目名称:GraphCreator,代码行数:37,代码来源:LineGraph.java

示例10: showSvgs

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
private void showSvgs(int index) {
    int x = 0, y = 0;
    for (String j :
            svgData.get(index).getValue().getData().values()) {
        SVGPath path = new SVGPath();
        path.setContent(j);
        Bounds bounds = path.boundsInLocalProperty().getValue();
        double scale = Math.max(bounds.getHeight(),bounds.getWidth());
        path.setScaleX(30 / scale);
        path.setScaleY(30 / scale);
        Button button = new Button();
        button.setGraphic(path);
        button.getStylesheets().add("css/svgbutton_style.css");
        button.setOnMouseClicked(event -> {
            SVGPath svgPath = (SVGPath) button.getGraphic();
            controller.drawSvg(svgPath.getContent());
            (button.getScene().getWindow()).hide();
        });
        button.setManaged(false);
        button.resizeRelocate(x , y, 50, 50);
        x+=55;
        if (x > 399) {
            x = 0;
            y += 55;
        }
        iconsPane.getChildren().add(button);
    }
}
 
开发者ID:xfangfang,项目名称:PhotoScript,代码行数:29,代码来源:GraphicBoard.java

示例11: PreviewCodeAreaBind

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
public PreviewCodeAreaBind(CodeArea area) {
  this.codeArea = area;
  this.popup = new PopupControl();
  this.contentPane = new AnchorPane();
  this.canvas = new Canvas(width, height);
  this.region = new Region();
  this.svgPath = new SVGPath();

  contentPane.setBorder(LayoutUtil.getSimpleBorder(Color.BLACK, line));
  contentPane.setPrefWidth(width + 2 * line);
  contentPane.setPrefHeight(height + 2 * line);

  LayoutUtil.setAnchorZero(canvas);
  LayoutUtil.setAnchorZero(svgPath);
  LayoutUtil.setAnchorZero(region);

  region.setPrefSize(width, height);
  region.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null)));

  popup.setConsumeAutoHidingEvents(false);
  popup.setAutoHide(true);
  popup.setAutoFix(true);
  popup.setHideOnEscape(true);

  popup.getScene().setRoot(contentPane);

  area.setPopupWindow(popup);
  area.setPopupAlignment(PopupAlignment.CARET_BOTTOM);

  DragSupport.bind(popup);
}
 
开发者ID:XDean,项目名称:CSS-Editor-FX,代码行数:32,代码来源:PreviewCodeAreaBind.java

示例12: createLayerNode

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
private Node createLayerNode(SvgLayerData layer) {
    SVGPath pathNode = new SVGPath();
    if (layer.getPath() != null) {
        pathNode.setContent(layer.getPath());
    }
    if (layer.getFill() != null) {
        try {
            pathNode.setFill(Color.web(layer.getFill()));
        } catch (IllegalArgumentException ignored) {
        }
    }
    pathNode.getStyleClass().add(PATH_STYLE_CLASS);
    return pathNode;
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:15,代码来源:SvgView.java

示例13: createSVGPath

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
protected SVGPath createSVGPath()
{
	SVGPath p = new SVGPath();
	applyNodeProperties(p);
	applyShapeProperties(p);
	p.setFillRule(fillRule);
	return p;
}
 
开发者ID:andy-goryachev,项目名称:FxEditor,代码行数:9,代码来源:FxIconBuilder.java

示例14: createRow

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
private HBox createRow(IntFunction<SVGPath> path) {
	HBox row = new HBox(10);
	row.setAlignment(Pos.CENTER);
	for (int i = 2; i < 6; i++) {
		row.getChildren().add(path.apply(i * SIZE));
	}
	return row;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:9,代码来源:SVGIcons.java

示例15: lines

import javafx.scene.shape.SVGPath; //导入依赖的package包/类
private SVGPath lines(int size) {
	SVGPath path = new SVGPath();
	path.setFill(Color.ALICEBLUE);
	path.setStroke(Color.BLUE);
	path.setContent("M0," + size + "L" + size / 2 + ",0 " + size + "," + size + " " + size / 2 + "," + 2 * size / 3 + "z");
	return path;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:8,代码来源:SVGIcons.java


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