+ [task#127424] add region coloring logic of think3c widget.

This commit is contained in:
wangzemei
2024-09-05 16:39:53 +08:00
committed by 刘刚
parent b348b851db
commit a21f661abf
+19
View File
@@ -202,7 +202,26 @@ function colorRegions(binaryImageData)
ctx.save();
ctx.fillStyle = colors[colorIndex % colors.length];
/* 遍历区域所有行,进行颜色填充。 */
/* Traverse all rows in the region and fill them with colors. */
region.rows.forEach((row, key) => {
if(row)
{
if(Array.isArray(row))
{
row.forEach((item) => {
ctx.fillRect(item.left, key, item.right - item.left + 1, 1);
});
}
else
{
ctx.fillRect(row.left, key, row.right - row.left + 1, 1);
}
}
});
});
resolve(canvas.toDataURL());
};
});