我想在图像中绘制颜色区域(不是所有区域,假设我想在图像中绘制颜色到圆圈)它似乎是photoshop上的油漆桶工具。我应该怎么做? 提前致谢
答案 0 :(得分:1)
您是否在推断要填充的形状或填充算法时遇到问题?我从你的问题中推断出你的大部分麻烦都在于算法。
直接来自维基百科,这里是用于洪水填充的伪造算法。
Flood-fill (node, target-color, replacement-color):
1. If the color of node is not equal to target-color, return.
2. Set the color of node to replacement-color.
3. Perform Flood-fill (one step to the west of node, target-color, replacement-color).
Perform Flood-fill (one step to the east of node, target-color, replacement-color).
Perform Flood-fill (one step to the north of node, target-color, replacement-color).
Perform Flood-fill (one step to the south of node, target-color, replacement-color).
4. Return.