在UIView上层填充颜色选定区域

时间:2011-08-18 14:25:39

标签: ios image colors paint flood-fill

我正在尝试为iPhone / iPad开发涂料类型App。我做了70%,但一个功能需要时间来完成它。我已在其中添加了“填充所选区域的选定颜色”功能。我做到了,但它需要花费很多时间或工作太慢。由于此功能,整个应用程序变得冻结。     图纸结构: -     UIView(父视图)       -UIImageView(SubView1) - 将图像保留为背景       -UIImageView(SubView2) - 绘制颜色或绘制线

In above structure, Parent view is work as a Canvas View and Subview1 is lowerview and Subview2 is upperview.

My approach :-
1)finding currnet point.
2)getting pixtel color.
3)get screen shot for whole screen.
4)get array for those pixtel who have a same pixtel color as select pixtel in current screen shot
5)now we use 4Q pixtel fill color for identifying pixtel who is connected with selected pixtel and making array for all those pixtel.
6)After getting the final array for the pixtel, we draw a pixtel with selected color.

Any one help.
I need a another implementation for Flood fill with a more smooth way functionality.
Pls provide me a Code sample.

Thanks in Advance.

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

我找到了这个,它对我来说很有用!

https://github.com/Chintan-Dave/UIImageScanlineFloodfill

也很容易实现。