diff --git a/lib/zin/wg/think3c/js/v1.js b/lib/zin/wg/think3c/js/v1.js index 33dec1441c..7f606d0376 100644 --- a/lib/zin/wg/think3c/js/v1.js +++ b/lib/zin/wg/think3c/js/v1.js @@ -128,3 +128,23 @@ function getRegionInfo(pixels, visited, x, y, width, height) return region; } + +function findRegions(pixels, width, height) +{ + const visited = {}; + const regions = []; + for(let y = 0; y < height; y++) + { + for(let x = 0; x < width; x++) + { + const index = (y * width * 4) + (x * 4); + if(pixels[index] === 255 && !visited[y + ',' + x]) + { + const region = getRegionInfo(pixels, visited, x, y, width, height); + regions.push(region); + } + } + } + + return regions; +}