为 UIView 上层的选定区域填充颜色
我正在尝试为iPhone/iPad开发绘画类型应用程序。我已经完成了 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.
I am trying to develop paint type App for iPhone/iPad. I have done 70% but one functionality is taking time to complete it. I have added To Fill Selected Area with Selected Color functionality inside it. I did it but it is taking to much time or working too slow. Due to this functionality, whole App become freeze.
Structure of Drawing View :-
UIView(Parent View)
-UIImageView(SubView1)-To keep image as a background
-UIImageView(SubView2)-To draw color or draw line
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用基于堆栈的洪水填充:http://www.drowningintechnicaldebt.com/ShawnWeisfeld/archive/2006/12/04/stack-based-flood-fill-algorithm.aspx
Use a stack based flood fill: http://www.drowningintechnicaldebt.com/ShawnWeisfeld/archive/2006/12/04/stack-based-flood-fill-algorithm.aspx
我发现了这个,它对我来说是一种享受!
https://github.com/Chintan-Dave/UIImageScanlineFloodfill
也很容易实现。
I found this and it worked a treat for me!
https://github.com/Chintan-Dave/UIImageScanlineFloodfill
Very easy to implement too.