private void scanLineSeeds(int y, NPBound bound, Color blockColor) { if (y >= 0 && y < Kernel.PIXLINECOUNT) { int xPos = bound.xStart; bool isIn = false; while (xPos <= bound.xEnd) { if (mKernel.cppGetPxColor(xPos, y).ToArgb() == blockColor.ToArgb()) { if (!isIn) { if (!mMapCurArea.ContainsKey(GetKey(xPos, y))) { mSeeds.Add(new NPPoint(xPos, y)); } isIn = true; } } else { if (isIn) { isIn = false; } } xPos++; } } }
public void DoBlockStatistics(int x, int y, Color blockColor) { mSeeds.Add(new NPPoint(x, y)); int count = mSeeds.Count; //order: FILO while (count != 0) { NPBound bound = fillLineSpan(mSeeds[count - 1].x, mSeeds[count - 1].y, blockColor); scanLineSeeds(mSeeds[count - 1].y - 1, bound, blockColor); scanLineSeeds(mSeeds[count - 1].y + 1, bound, blockColor); mSeeds.RemoveAt(count - 1); count = mSeeds.Count; } }