http://en.wikipedia.org/wiki/Flood_fill#Stack-based_recursive_implementation_.28Four-way.29
Flood-fill (node, target-color, replacement-color): 1. If target-color is equal to replacement-color, return. 2. Set Q to the empty queue. 3. Add node to the end of Q. 4. While Q is not empty: 5. Set n equal to the last element of Q. 6. Remove last element from Q. 7. If the color of n is equal to target-color: 8. Set the color of n to replacement-color. 9. Add west node to end of Q. 10. Add east node to end of Q. 11. Add north node to end of Q. 12. Add south node to end of Q. 13. Return.
本文介绍了一种基于栈的递归实现的四向泛洪填充算法,该算法用于将指定区域的颜色从目标颜色替换为替代颜色。通过使用队列结构来遍历并更新区域内所有像素的颜色。
1940

被折叠的 条评论
为什么被折叠?



