本文整理汇总了Java中javafx.scene.canvas.GraphicsContext.getLineWidth方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsContext.getLineWidth方法的具体用法?Java GraphicsContext.getLineWidth怎么用?Java GraphicsContext.getLineWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.canvas.GraphicsContext
的用法示例。
在下文中一共展示了GraphicsContext.getLineWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawLines
import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
@Override
public void drawLines() {
CoordProjector projector = getProjector();
GraphicsContext context = getGraphicsContext();
for (int i = 1; i < 20; i++) {
//Horizontal Lines
DrawCoords start = projector.fromBoardCoords(getCoords(1, i));
DrawCoords end = projector.fromBoardCoords(getCoords(19, i));
context.strokeLine(start.getX(), start.getY(), end.getX(), end.getY());
//Vertical Lines
start = projector.fromBoardCoords(getCoords(i, 1));
end = projector.fromBoardCoords(getCoords(i, 19));
context.strokeLine(start.getX(), start.getY(), end.getX(), end.getY());
}
Canvas canvas = context.getCanvas();
StoneDrawer drawer = new SimpleStoneDrawer(canvas);
double scale = DimensionHelper.getStoneRadius(canvas);
scale = (context.getLineWidth() * 4) / scale;
drawer.drawStones(getHandicapStones(9), BLACK, scale);
}