【发布时间】:2014-11-08 02:36:25
【问题描述】:
我正在使用能够绘制一系列贝塞尔曲线的路径。
但是,我需要将填充设置为虚线效果,而不是实心填充。
我看过这篇文章:JavaFx 2.x : How to draw dashed or dotted lines?,但它涉及将形状对象放到舞台上,而我是直接绘制到 GraphicsContext 以创建 jpg 图像。
这样可以吗?
编辑: 这就是我目前画线的方式:
// cv is a Canvas object, previously created and initialised earlier
cv.beginPath();
cv.moveTo(x, y);
cv.cubicTo(x1, y1, x2, y2, x3, y3);
// Either finish with this
cv.closePath();
cv.fill();
// or this
cv.setLineWidth(0.5);
cv.stroke();
【问题讨论】:
-
在添加实心填充路径的位置显示当前代码。
-
@UlukBiy - 刚刚按要求添加了代码。