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

Re: [pygame] GSoC project proposal: A new draw module



On, Sun Mar 07, 2010, Julian Habrock wrote:

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

What would be interesting here is, what the Pen class would offer except
from the drawing functions wrapped up in a class and som additional
shapes.

What about e.g. an aa-property to keep the argument amount low,
transformation and rotation angles for the x- and y-axis (implicit
transformation done upon drawing) or even vector support (e.g. for
faster 2d, 2.5d, 3d operations on the shapes) using the math module?

What do you think about working out some basic Pen (and utility)
class(es) as an example (no need to implement any function or property,
just a stub of the class, we can examine and design)?

Regards
Marcus

Attachment: pgpHorQwTFqnq.pgp
Description: PGP signature