我想基于如何在所选点之间绘制线来上传图像,并且我想捕获该特定图像 所以请建议如何用html5写
答案 0 :(得分:0)
您可以绘制路径,在画布上给出某些点(或点)以在它们之间绘制一条线。然后你可以划线(实际上画线到画布)。
var canvas = document.body.appendChild(document.createElement("CANVAS")), context = canvas.getContext("2d");
context.beginPath();
// all points are given as x (from left to right), y (from top to bottom)
context.moveTo(10, 20); // x = 10 (10 px from the left edge of the canvas), y = 20 (20 px from the top edge of the canvas)
context.lineTo(100, 97); // x = 100, y = 97
context.lineTo(50, 105); // x = 50, y = 100
context.stroke();
[MDN]