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