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

[pygame] GSoC project proposal: A new draw module



Hello,

I'd like to rewrite/improve the pygame draw module(s) as a GSoC project.
Currently, there are pygame.draw and pygame.gfxdraw, but both are not
very usable. There is just a small set of basic shapes to draw. Another important point is the missing anti-aliasing. Well, the new gfxdraw has some aa-functions, but they are too inflexible. Lets say you need to draw a filled, anti-aliased circle. There is no function to do that, even though there are four (!) functions to draw some kind of circle. These functions can draw a circle either filled or anti-aliased (or not anti-aliased and not filled) but not both. The same applies to the other
shapes.

I made some small tests[1] and it was really easy to get some nice shapes[2]. Of course, the code is dirty and slow, but its just a test to get an idea of an usable draw module.

To handle all these options and parameters, the code could be organized more object
oriented. One idea was to handle it like PIL:

mypen = pygame.draw.Pen(surface, ...)
mypen.circle(pos, rad, ...)

Then, shapes could not only be filled with plain color, but also pixel data from another
surface or maybe some kind of texture or so.

Just some first thoughts and rough ideas.


Regards,
Julian


[1] http://bitbucket.org/schlangen/pexdra/
[2] http://bitbucket.org/schlangen/pexdra/src/tip/doc/source/images/simple_example.png#