I implemented floodfill algorithm (with stack) using Objective C. It is very slow as for each pixel few methods are called (I ported existed C implementation). Even on C it is quite slow as to compare 2 colors (for each pixel) 2 function calls used. Do you have any ideas to I can optimize it?
One of my ideas - to convert byte array of RGBA date to array[][] of color
struct and use checking for equality of each element (e.g. color.r
, color.g
, color.b
and color.a
).
But still it will be a question for blending colors, but I can call blend function only if alpha in in certain range.
Thank you! P.S: I'll share final result with acceptable performance under github, so anyone will be able to use it in the future...