_ mȻڌH_l(f)҂ȥL̈D Ҫ҂Ҳͨ^3ȥF(xin) ҂ΌF(xin)̈DкСһ քLƾ Lһε˼· ҂@Lƾ ʹõcanvas.strokeRect(x,y, w, h)Lһ߅ x:c x S(bio) y:
mȻڌH_l(f)҂ȥL̈D
Ҫ҂Ҳͨ^3ȥF(xin)
҂ΌF(xin)̈DкСһ
քLƾ
҂@Lƾ
ʹõcanvas.strokeRect(x,y, w, h)Lһ߅
x:c x S(bio)
y:c y S(bio)
width:εČȡֵ߅ؓ(f)ֵ߅
height:εĸ߶ֵ½ؓ(f)ֵ
עһw,h@ɂ(sh)ֱؓ(f)ֵ
w,hؓ(f)(sh)F(xin)2бQľ
Document
ͨK�K�K�K�K�K�K˾�B(ti)K�Kƾ�KI�
K�K�K�K�KҪ�ֶK�Kһ�K�K�K?K�ҪK�K�Kq|K�K�K�
1.K�canvasעK�K�_(d)K�K?K(ji)ͿKq�rK�Kq|K�εK�Kg|K�K?x,y)
K�Kͬʱ�K�K�KҪ�xK�Kgע�K�K�KӞKq|K�̧K�Kq|K�
2.K�K�K�ؚK�Kg�Kͨ�K�K�KC�K�KIĿ�Kߡ�
K�K�K�εĿK�Ⱥ߶Kg�K�K�KҪʹ�VK�Kֵ�K�мK�?
K�K�K�K�K�K�{K�K?
3.K�K�Ķ�Kg�K�ƳK֮ǰע�K�K�K�ؚK�K�Ķ�K�K?
ͨK�K�K�K�K�DƬK�K�K�K�ȻK�K�KӞK�KƻIK˾�KI�
K�KǻIK�K�Kظ�K�·K�K�
K�K�KPK�һKqIK�Kظ�·K�K�ԭK�
K�K�K�ÿK�KӞKe�K�KУ�K�K�K�{K�ΡK?
ֻҪK�K�K(ji)�K�ǰK�K�վK�K�DzK�NͿK�ԽK�K�K�K�K?
K�K�K�K�K�һK�
function drawRect(x1,y1,x2,y2){
// K(ji)|K�K�εĿK�Kg�K�K�K�KҪʹ�VK�Kֵ�K�K�мK�K? // K�rK˿�KӞK�K�K�K�K�K�Kq�K�K�K�NK�εĿK�K? let rectWidth = Math.abs(x2-x1)
let rectHeight = Math.abs(y2-y1)
// K惦K�KI�K�K�K�Ϣ
rectArr = [x1,y1,rectWidth,rectHeight]
// K(ji)�Kƾ�K�ǰK�K�Kǽ�K�K�K�գK�K�՟K�ƣK�ͲK�K�KӞK�KqPK�K? ctx.clearRect(0,0, canvasEle.width, canvasEle.height)
// K�Kq�Kƾ�K�
ctx.strokeRect(...rectArr)
}
K�ЩK�Kǵ�СK��K?
K�K�K�Kg|K�K�K�K?Kյ�K�K�K^ǡ�
K�:KC�K�(900, 1000)K^ӞK�(50, 50)K�K�K�K?
K�K�K�K�KePK�K�{K�ΣK�DzK�ǻK�K�K�K�Kأ�
_K�K�K�K�?
K�rK�KƵľ�KIԌK�K�K�K�KǵPK�K�xK�ơK�_(d)K�K�D
K�δK�K�K�K�K�Kأ�
canvas.rect(x,y,w,h)KCPK�K�K�һK�K�K�·K�
x:K�K�K�K� x K�K�K
y:K�K�K�K� y K�K�K
width:K�KIĿ�K�K�ֵK�K߅�K�ֵK�K�ߡK?
height:K�KIĸ߶ȡ�K�ֵKq�K�K�ֵK�K�K�
K�K�K�K�lK�Kһ�K�K�KqPK�K�K�K�KqPK�K�K�Kֱ�xK�K�՟K�K�ϡK?
K�ҪK�K�stroke()K�fill()K�K�K�ʾK(ji)�K�K^�
function drawRect(x1,y1,x2,y2){
let rectWidth = Math.abs(x2-x1)
let rectHeight = Math.abs(y2-y1)
// K�K�֮ǰK�K�K֮ǰʵʱ�ؚK�K�K�K�Ke�K�·K�
ctx.clearRect(0,0, canvasEle.width, canvasEle.height)
// K�ʼK�K�
ctx.beginPath();
// K�K�·K�K�K�
ctx.rect(Math.min(x1, x2), Math.min(y1, y2), rectWidth, rectHeight);
// K�K�K�K�K�K�K�
ctx.stroke();
}
K�K�1K�K�K�: canvas.strokeRect:K�KƵ�K߅�canvas.rectK�K�K�KI�·K�(K�K�K�K�K�K�K(ji)�K�K�)
K�K�2K�rK�: canvas.strokeRectK�K�K�K�Kơ�canvas.rectK�K�K�K�K�Kƣ�K�ҪK�K�stroke()K�fill()K�Kܻ�K�
K�ͬK㣺
1.K�Kǻ�Kƾ�K�
2.K�KܵԌK�K�ͬ
3.K�K�ͨK�strokeStyle(K�ɫ)K�lineWidth(Kߵ_(d)(x))K�K�K�K�K�ʽ
function drawRect(x1,y1,x2,y2){
let rectWidth = Math.abs(x2-x1)
let rectHeight = Math.abs(y2-y1)
let endX = Math.min(x1, x2)
let endY = Math.min(y1, y2)
// K�K�֮ǰK�K�K֮ǰʵʱ�ؚK�K�K�K�Ke�K�·K�
ctx.clearRect(0,0, canvasEle.width, canvasEle.height)
// K�K�֮ǰK�ЩK惦K� beforeRectArr K�K�Kеľ�K�
allRectInfoArr = [endX, endY, rectWidth, rectHeight]
ctx.clearRect(0,0, canvasEle.width, canvasEle.height)
beforeRectArr.forEach(element => {
ctx.beginPath();
ctx.strokeRect(...element)
ctx.stroke();
});
// K�ʼK�K�·K�
ctx.beginPath();
// K�KƱ�KIľ�K�·K�
ctx.rect(...allRectInfoArr);
// K�ʼK�K�K�
ctx.stroke();
}
// K�K�K�K�Ķ�K�rK�ҪKƻI֮ǰעK�KӞKq|K�̧K�Kq|
function canvasMouseUpHandler(){
savaBeforeRect()
canvasEle.removeEventListener('mousemove', canvasMoveHandler)
canvasEle.removeEventListener('mouseup', canvasMouseUpHandler)
}
function savaBeforeRect(){
beforeRectArr.push(allRectInfoArr)
}
Document
K�KС�K�K�K�K_(d)IJK�K�ĻK?
K�KԸ�Kҵ�K�K�wKл�ˡK?
K�K�K�K�:
K�Kѡ�оK�ΣK�K�ľK�δKС�K?
K�K�aK�K�K�K�K�K�K?
K�λK�KԌK�KPK�ZK?
@Kӻ�TK�K�K�K�KPK�K�һK�K�K�K?/a>
KeӞK�K�K˹�K�K�ģKͻ�K�K�TFDSK�KerasK�K�K�K�K�
KeӞK�K�K�K�(yng)KCĺ�K�K�ʾֱK�(yng)K�ȫK̽�K�
KeӞWiFiK�K�(K�)K�WiFiK�K�K�WiFiK�K�
KeӞwK�W(xu)(x)K�K˹�K�K�ģK�Ӗ(xn)K�Ke�W(xu)
KeӞK�K�K�I(y)KùK�K�K�K�K�K|ʹKCPK�
KeӞK�Kg�K?Pytorch Kе� DataSet K� DataLoader
KeӞgolang sliceK�سK�K�K�K�K�IK�ֶK?/a>
KeӞVue3+Element PlusǰK˿�ָܴ�K?/a>
KeӞK�K�ElasticsearchK�K�K�K�PythonK�K�ʾK�
KeӞK�K�K�K�ϵy(tng)K�K�RTMPK�K�K�K�^K�lK�K�˷K�K�K�K�KC�K�K�K�
KeӞʹK�PythonK�ȡK͵�K�NetCDFK�ʽKeӞrK�K�Ke|
KeӞK�Kϵy(tng)K�K�(qun)K�K�K�KRuoYiϵy(tng)Ke�K?/a>
KeӞK�վK�K�K�K�K�K�K�K�K�K^_(d)K�K�K�KPK�İK�K�뷢�ʼK?a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c0a1a4ada9ae80a8a1afb4a5eea3afad">[email protected]
K�ICPK�2022002427K�-10 K湫K�K�K�K�43070202000427K�© 2013~2024 haote.com K�K�K�