I am using JavaFX to render some SVG stuff. I defined many methods, returning the paths of different SVG shapes (ellipsis, circle, rectangle, lines, etc). All of them seem to work, except the line method. JavaFX doesn't return an error (meaning that the path is probably correct), yet it doesn't draw anything. Here is my method.
public static SVGPath line(float startX, float endX, float startY, float endY, PositionType positionType)
{
SVGPath path = new SVGPath();
path.setContent(positionType.getMoveto()+startX+","+startY+positionType.getLineto("l")+endX+","+endY);
return path;
}
The method getMoveto()
returns either M
or m
, depending on the PositionType
, and getLineto()
returns either L
or l
.
Here is a sample method call :
SVGPath test2 = SVGPrimitives.line(20f, 30.1f, 23f, 89.21f, PositionType.ABSOLUTE);
And here is the path that's returned :
M20.0,23.0 L 30.1,89.21
It does seem valid to me, yet nothing is drawn...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…