diff --git a/lib/zin/wg/think3c/js/v1.js b/lib/zin/wg/think3c/js/v1.js index 05adfd9458..2b4c865fb2 100644 --- a/lib/zin/wg/think3c/js/v1.js +++ b/lib/zin/wg/think3c/js/v1.js @@ -189,10 +189,20 @@ function colorRegions(binaryImageData) const pixels = ctx.getImageData(0, 0, canvas.width, canvas.height).data; let regions = findRegions(pixels, canvas.width, canvas.height); + ctx.globalCompositeOperation = 'source-over'; + /* 过滤掉小区域。 */ /* Filter out small regions. */ const minArea = 90; regions = regions.filter(r => r.area >= minArea); + + regions.forEach((region, colorIndex) => { + /* 保存当前状态。 */ + /* Save current state. */ + ctx.save(); + + ctx.fillStyle = colors[colorIndex % colors.length]; + }); resolve(canvas.toDataURL()); }; });