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

Re: [pygame] "Paths"

In python, aggdraw (a wrapper of the very very awesome Anti-grain geometry) can do that path stuff:
and aggdraw can be used to make pygame surfaces.

...such apis can be very cool tools to have, but are usually too slow to use for drawing your whole scene on a frame-by-frame basis (they are best used for drawing stuff onto surfaces or textures, and then using the faster routines to work with the surfaces/textures). With software rendering systems (like pygame), you can actually get away with limited use of such apis, but on hardware-accelerated apis, such things usually demolish your frame rate quite quickly.

... speaking of which, using CoreGraphics specifically on iPhone often results in much less than satisfactory performance results. The best results are either programming with OpenGL ES,  or using CoreAnimation Layers or UIViews. CoreGraphics can be used to create CoreAnimation layers to work with, but is a dog for drawing stuff to the screen directly.

... and it doesn't take a month to get stuff on the screen with OpenGL ES, you could get functional in a week, I'd say.

On Sat, Jan 23, 2010 at 4:16 PM, Bill Coderre <bcbc@xxxxxxx> wrote:
So I've been hacking Mac OS X's "Core Graphics" as a way of learning iPhone coding (gotta sharpen those job skills), and I was wondering if there's an extension to pygame or python somewhere that implements "path" based graphics.

In this model, you do stuff roughly like this:
1) Open a path in the current context (graphics device, in pygame, I guess that would be a surface)
2) Move to a starting point
3) repeatedly add lines, rectangles, arcs, and bezier curves to the path
4) Close the path (which implicitly adds a line back to the starting point)
5) Fill or stroke (or both) the path, to get graphics to appear.

If I wanted to write python and use Mac OS X's core graphics, there's a bridge already built. What I want is to use my code on other platforms, specifically the OLPC. (I realize this might be an unreasonable expectation, since the OLPC has very little graphics horsepower.)

I am currently totally staying away from OpenGL, since it seems like it'll take me a month to make headway into that. Maybe, however, OpenGL already has path-based stuff.

Anyway, I figured I'd toss this out there, see what people think.