views:

619

answers:

2

i am developing a iphone app. i have a background image lets say an airplane with black color out lines and from color palette user can pick a color and fill the region of airplane....any help, code , suggestion will highly be appriciated

+1  A: 

A simple fill algorithm should do. just expand from the point you are on until you meet region end pixels see http://en.wikipedia.org/wiki/Flood_fill you can also try googling for Boundary Fill algorithm

Nuno Furtado
A: 

My first though was to have a UIView and a mask image on top of that with the plane but this only works in certain situations. If the shape of the plane does not change you could also change the color and then "fill" the plan in during the drawRect using functions like CGContextAddArc and CGContextAddRect.

Ryan Detzel
as i am new to iPhone app development so i dont know how to get the current color of the pixel from the touch and then how to flood fill till the boundaries any code snippet or example code will highly be appreciated.
xavoDev