What you describe isn't flood-filling - flood filling means painting from a point (like the paint bucket) and it's for like filling circles and stuff.
To answer your question though, pygame/sdl provides features identical to PHP's imageColorSet and it's ilk. 8-bit images in pygame have palettes (indexed colors). In particular, Surface.set_palette_at is a direct imageColorSet equivalent. If you don't want to use palette's, though, then checking each pixel and replaceing each pixel (Color Replacement - what you have been doing) is the only way to go, but Surface.get_buffer can be used to make such things much faster. On Fri, Apr 11, 2008 at 6:53 PM, Kevin <[EMAIL PROTECTED]> wrote: > Hi, I'm looking for a fast way of "flood-filling" an image, like changing > all green to red and such (akin to PHP's imageColorSet() function if that > helps). The current method I'm looking at is locking the surface, getting > every pixel on the surface one by one and then setting it if it's a certain > color, and unlocking, but even the documentation says that's going to be > slow (maybe it's fast enough with the new PyGame release?). There's a good > chance I might have missed something in pygame.display, but any suggestions > or pointing to some built-in thing would be appreciated. >
