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

Re: [pygame] multi-width aalines and aacircles

I backported pygame2.sdlgfx.primitives back into Pygame just as a quick and dirty way to try out SDL_gfx. I made it optional, like movieext, so we could decide if we should keep it as is. Though at first glance gfxdraw appears to differ from the draw module, having no line width argument for instance, a closer look shows that draw builds up line width through repeated draws of a single pixel width line. Underneath, draw is just an earlier version of SDL_gfx with some features added over top. I would suggest instead of a separate gfxdraw module, which duplicates much that is in draw, to simply rework draw to use SDL_gfx as its back end. draw would be extended to expose the new functions added by SDL_draw. Including the SDL_gfx source files with Pygame is fine with me. But the RGBA versions of the functions were justed used for convenience. The Color versions can be used as well and would save a C function call.


René Dudfield wrote:
hi again,

Or for the draw stuff...
We could just include these two files:

Then use this in Setup
GFX = src/SDL_gfx/SDL_gfxPrimitives.c
gfxdraw src/gfxdraw.c $(SDL) $(GFX) $(DEBUG)

I added those two files in that directory to svn for now. So people should be able to build it out of svn on linux/unix... and download binaries (hopefully a couple of hours) from here: http://thorbrian.com/pygame/builds.php

Committed revision 1980.


On Sun, Mar 29, 2009 at 2:11 PM, René Dudfield <renesd@xxxxxxxxx <mailto:renesd@xxxxxxxxx>> wrote:


    very cool module :)

    I uploaded some png's for people to see:

    However, with ubuntu SDL_gfx I get this error:

    >>> import pygame.gfxdraw
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: /usr/lib/python2.5/site-packages/pygame/gfxdraw.so:
    undefined symbol: arcRGBA

    I guess arcRGBA isn't in the version I have... which is version
    2.0.13 - a pretty a old SDL_gfx (current is 2.0.19pre).

    So... I'll try and start submitting bug reports to distros for
    them to update SDL_gfx.  However that won't help us for 1-2 years
    -- by the time they process the bug report, then finally get
    around to packaging the newer version - then time for people to
    upgrade their distros...  Also, I think we'll probably try and get
    some newer fixes into SDL_gfx, so for now including it with pygame
    is probably better.

    Instead, can we include SDL_gfx parts in with pygame?  including
    the whole directory in src/SDL_gfx/ .

    I changed Setup to this, which compiled and worked:

    GFX = src/SDL_gfx/SDL_gfxBlitFunc.c src/SDL_gfx/SDL_gfxPrimitives.c
    gfxdraw src/gfxdraw.c $(SDL) $(GFX) $(DEBUG)

    Instead of including it in src/... we could put it in
    branch/SDL_gfx and put a svn external to src/SDL_gfx   (SDL_gfx
    doesn't appear to use public version control).  Or we could just
    include the needed files needed.  I think a branch with svn
    external to src/SDL_gfx would be best... then it's nicely
    separated.  Then when we release a source tar.gz/.zip we include
    it with the pygame sources.


    On Thu, Mar 26, 2009 at 6:33 AM, Lenard Lindstrom <len-l@xxxxxxxxx
    <mailto:len-l@xxxxxxxxx>> wrote:

        You can see for yourself:


        Because of a bug aapolygon_gfx.py will not work with the gfx
        enabled Windows binaries I have provide. The latest Pygame out
        of SVN is needed. But you can still look at the images I took
        from a screen shot.


        Lenard Lindstrom wrote:

            The results actually look good though, if one first draws
            the outline, then the filled version. Circles not quit so
            good, but better than with no anti-aliasing.


            RB[0] wrote:

                You could do a filled polygon and then an aa one
                around it...
                But I think then you'd be getting a lot slower...

                On Wed, Mar 25, 2009 at 1:44 PM, Lenard Lindstrom
                <len-l@xxxxxxxxx <mailto:len-l@xxxxxxxxx>
                <mailto:len-l@xxxxxxxxx <mailto:len-l@xxxxxxxxx>>> wrote:

                   The aa polygon is not filled, and the filled
                polygon does no aa.


                   René Dudfield wrote:

                       good idea.

                       there's an aa-polygon in sdl gfx

                       On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing
                <mailto:greg.ewing@xxxxxxxxxxxxxxxx>>> wrote:
                                   Lenard Lindstrom wrote:

                                             Yes, but we still need an
                aaline algorithm with line
                                               Find an aa polygon
                algorithm and then use it to
                           draw line-shaped polygons.

Lenard Lindstrom