[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Effecient way to 'darken' a surface?



With my alpha idea I was thinking of having a bunch of backgounds to blend with as needed not change ones alpha each time. As was pointed out you will only have 255 levels of gray and you might be able to step though them at jumps of 8 so you would only need 32 of them or less depending on how dark to how light you need to go. I do hope to learn what is the fastest way. I was under the idea that this was a whole screen thing. If it is just a tile set than make 32 tile sets and have real speed.

Also untested by me but can't you use refrenced color and change the refrence for fast color updates?

On 12/20/05, andrew baker < failrate@xxxxxxxxx> wrote:
Include instructions to the player to slowly squint his eyes until you say stop.

Failing that, one quick optimization you might be able to get away with is not altering the color every step, but perhaps by 8 or more steps at a time.  I'm not sure if that would be not smooth enough a color transform for you, though.

Also, you make no mention if you are transforming tiles or just one large bitmap.  If you are color transforming tiles, then you could probably just alter the colors of the source tiles and then blit them, as opposed to blitting first, then altering.

Kinda hard to tell what would work for you without knowing what the overall application is.


--
Andrew Ulysses Baker
"failrate"