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

Re: [pygame] PATCH: pygame.draw moire hole fix



It seems that sdl_gfx has been ported to sdl2
http://sdl.5483.n7.nabble.com/Interpolate-and-SDL-2-0-alternatives-to-sdl-gfx-features-td37500.html
Might it be that something has to be added to the core to get decent
primitive support? PySDL2 seems to wrap the port
http://pysdl2.readthedocs.org/en/latest/modules/sdl2_sdlgfx.html is
that what you're referring to when you say things are worse?

This thread is also interesting:
http://forums.libsdl.org/viewtopic.php?p=33873&sid=a3c6a0cf0146ed93007c8963e8cad3b1
It suggests there's scope for two gfx libraries: a software-based one
that is feature complete and robust, and a OpenGL-based version that's
faster but harder to work with.

On 5 February 2014 17:43, Paul Vincent Craven <paul@xxxxxxxxxxxxxxxx> wrote:
> I'd love to see that issue fixed. A search of the web turns up some good
> algorithms for doing this, and I've implemented some myself.
>
> SDL 2 does change things -- for the worse. The drawing primitives don't have
> the ability to set the thickness. You can draw with just opengl and use
> those commands to get thicker lines, but if you use an opengl context to
> render, then it is hard to use the other non-opengl items. If SDL 2 had some
> decent drawing primitives I'd switch my tutorial for programarcadegames.com
> over to it.
>
> Updating Pygame to not use SDL 1 and use a decent set of code to draw shapes
> with a thick pen would be great. Or figure out how to get nice drawing
> primitives on SDL 2.
>
> Paul Vincent Craven
>
>
> On Tue, Feb 4, 2014 at 6:01 PM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
>>
>> Hi Jeffrey,
>>
>> An anti-aliased filled ellipse function has been suggested before. But
>> finding a suitable drawing algorithm was always a problem. Here is the most
>> recent thread:
>>
>> http://article.gmane.org/gmane.comp.python.pygame/23447
>>
>> The source for pygame.draw is here:
>>
>>
>> https://bitbucket.org/pygame/pygame/src/37fb5da907e24c581e5bffbbaf9e4073162e496d/src/draw.c?at=default
>>
>> There is also pygame.gfxdraw, which has an anti-aliased width 1 draw
>> circle:
>>
>>
>> https://bitbucket.org/pygame/pygame/src/37fb5da907e24c581e5bffbbaf9e4073162e496d/src/SDL_gfx/SDL_gfxPrimitives.c?at=default
>>
>> But this is all Pygame for SDL 1. SDL 2 is a game changer; maybe shape
>> rendering will be done in opengl.
>>
>> Lenard Lindstrom
>>
>>
>> On 14-02-02 08:58 PM, Jeffrey Kleykamp wrote:
>>>
>>> Hi everyone,
>>>
>>> I'm new here so please be nice.
>>>
>>> I created new versions of pygame.draw.circle, arc, ellipse that don't
>>> suffer from the moire hole problem. I don't know if there's been some
>>> discussion or if a patch has already been submitted regarding this, but my
>>> version fixes them. See the picture that's attached. I also included
>>> functions to draw regular polygons and wedges.
>>>
>>> The strategy my circle draw function uses is to draw regular polygons
>>> with high number of sides so you can't tell it that it's actually a polygon.
>>> Similarly for other draw functions.
>>>
>>> I wanted to use aalines but it doesn't fill the polygon. If you look at
>>> the picture the first column is the current draw function, the second is the
>>> new draw function, the third is a composite of the new draw and aalines, the
>>> last is only the aalines.
>>>
>>> Running the file runs the test code that made the attached picture. Sorry
>>> I didn't comment much. I'll go back an fix it if there's interest in this
>>> code.
>>>
>>> I also couldn't find the pygame.draw source code to look at, so it would
>>> be nice if someone pointed me to where that was. Thanks!
>>>
>>> Sincerely,
>>> Jeffrey
>>>
>>> --
>>>
>>>       Jeffrey Kleykamp
>>
>>
>