A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: flood fill algorithms

  1. #1
    Member
    Join Date
    Jun 2009
    Posts
    35

    flood fill algorithms

    Are there any flood fill guru's out there? I need a flood fill type algorithm, that maintains a rectangle aspect... I could solve this using many nested loops checking each pixel - but I need the speed that the native methods provide, and hoping I can achieve it suing Bitmap Data and the flood fill method.

    Please check the attached image to see what I mean. Diagrams 1&2 show two different pixel locations, but the end result (3) is the same.
    Attached Images Attached Images

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Why would the result of 2 not be a narrow vertical band on the left side? Is the implicit horizontal then vertical sizing intentional?

  3. #3
    Member
    Join Date
    Jun 2009
    Posts
    35
    good point, the reason being that it would be to narrow to be useful. I'm attempting to find the bounds of a useful space, so x + y must meet a minimum size otherwise it will exit, ready for a new location to be given.

  4. #4
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Running a loop isn't that intensive if you have the bitmap already set up (here's an implementation) - For you though, you probably don't need all that - you could take a 1px tall bitmap of the row you clicked and use getColorBoundsRect in a loop or else just iterate over the pixels manually to find the block of like colors from where the mouse is, then repeat for the column.
    Please use [php] or [code] tags, and mark your threads resolved 8)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center