Thanks for the information, Brian. I wrote a little function that does
pixel-by-pixel (which isn't horribly slow for the images I want but could be
sped up a good deal I'm thinking), and since I don't want to work with just
8-bit images I think I'll check out buffers. I believe I was looking at this
image where the paint bucket would have done what I wanted, so I called it
flood fill... Still, thanks for catching that.

Lenard, thanks for your suggestion. I was considering something like that,
but it seems like I would have issues if I wanted part of the image to be
transparent always in certain places, not just where I want the color to
change...

On Fri, Apr 11, 2008 at 8:57 PM, Brian Fisher <[EMAIL PROTECTED]>
wrote:

> 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.
> >
>



-- 
This, from Jach.

How many programmers does it take to change a light bulb?
None. It's a hardware problem.

How many Microsoft programmers does it take to change a light bulb?
None. Microsoft just declared darkness as the newest innovation in
cutting-edge technology.

Reply via email to