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

Re: [pygame] Gradient Algorithm



Patrick Mullen schrieb:
Could you modify it so that it can handle horizontal or diagonal gradients as well? Horizontal is easy, I'm not sure about diagonals though. I guess you would have to increment y and x by their own separate speed for each iteration and then draw a line from 0,y to x,0. But that only works for top-left to bottom-right diagonals. I guess it needs a special case for all 4 diagonals, and horizontal, and vertical :)

Hi

I wrote some gradient code (well its a bit slow, in return you can do some different things like round gradients). It doesn't use numeric, only pure python and pygame.

I wanted to add it to the libraries section of the pygame site this morning, but I couldn't submit it (as known, there are some problems submitting projects at the moment). I think its too big for the cookbook section.

You can find it in the pygame section here: http://mypage.bluewin.ch/DR0ID/

Enjoy!

As usual, I'm open to suggestions. :-)

~DR0ID