+ [task#127424] add region coloring logic of think3c widget.
This commit is contained in:
@@ -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());
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user