[英]Remove Colored dots on HTML Canvas with Javascript
i = 0;
YNo = 1;
LineNo = 1;
for (i, n = pix.length; i < n; i += 4)
{
const r = pix[i],
g = pix[i + 1],
b = pix[i + 2];
if (r > 240 && g < 40 && b > 240 )
{
pix[i] = 0;
pix[i + 1] = 0;
pix[i + 2] = 0;
pix[i + 3] = 0;
x = (i / 4) % imgWidth;
y = YNo-1;
ctx4.beginPath();
ctx4.arc(x, y, 5, 0, 2 * Math.PI, false);
ctx4.fillStyle = "#000000";
ctx4.strokeStyle = "#000000";
ctx4.fill();
ctx4.stroke();
ctx4.closePath();
}
if(LineNo % imgWidth == 0)
{
YNo++;
}
LineNo++;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.