Re: [pygame] multi-width aalines and aacircles

2009-03-30 Thread Lenard Lindstrom
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.


Lenard


René Dudfield wrote:

hi again,

Or for the draw stuff...
We could just include these two files:
src/SDL_gfx/SDL_gfxPrimitives.c
src/SDL_gfx/SDL_gfxPrimitives.h

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.


cheers,


On Sun, Mar 29, 2009 at 2:11 PM, René Dudfield ren...@gmail.com 
mailto:ren...@gmail.com wrote:


Hi,

very cool module :)

I uploaded some png's for people to see:
http://rene.f0o.com/~rene/stuff/aapolygon.png
http://rene.f0o.com/%7Erene/stuff/aapolygon.png
http://rene.f0o.com/~rene/stuff/aacircle.png
http://rene.f0o.com/%7Erene/stuff/aacircle.png



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.


cheers,







On Thu, Mar 26, 2009 at 6:33 AM, Lenard Lindstrom le...@telus.net
mailto:le...@telus.net wrote:

You can see for yourself:

http://www3.telus.net/len_l/pygame/gfx_antialiasing.tar.gz

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


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.

Lenard

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
le...@telus.net mailto:le...@telus.net
mailto:le...@telus.net mailto:le...@telus.net wrote:

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

   Lenard


   René Dudfield wrote:

   good idea.

   there's an aa-polygon in sdl gfx


   On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing
   greg.ew...@canterbury.ac.nz
mailto:greg.ew...@canterbury.ac.nz
   

Re: [pygame] multi-width aalines and aacircles

2009-03-29 Thread pymike
I think if you look at a real SVG aaline...

http://upload.wikimedia.org/wikipedia/commons/thumb/8/8f/Simple_polygon.svg/588px-Simple_polygon.svg.png

...then look at the pygame one...

http://rene.f0o.com/~rene/stuff/aapolygon.pnghttp://rene.f0o.com/%7Erene/stuff/aapolygon.png

...the latter looks pretty rough.

-- 
- pymike


Re: [pygame] multi-width aalines and aacircles

2009-03-29 Thread Zack Schilling
The pygame line looks like there's something wrong with it. There are  
very few faded pixels at all. It's essentially not anti-aliased.


-Zack


On Mar 29, 2009, at 11:12 AM, pymike wrote:


I think if you look at a real SVG aaline...

http://upload.wikimedia.org/wikipedia/commons/thumb/8/8f/Simple_polygon.svg/588px-Simple_polygon.svg.png

...then look at the pygame one...

http://rene.f0o.com/~rene/stuff/aapolygon.png

...the latter looks pretty rough.

--
- pymike




Re: [pygame] multi-width aalines and aacircles

2009-03-29 Thread René Dudfield
hi,

it looks like there's one step in the pygame one which misses the aa
part.  If you zoom in on the image, you can see it fairly well.

The svg one has way more transparent pixels - and looks a bit fuzzy,
even jaggy in some parts(bottom lines going high left, to low right).


You can see the source for the pygame one here:
http://www.seul.org/viewcvs/viewcvs.cgi/trunk/src/SDL_gfx/SDL_gfxPrimitives.c?rev=1980root=PyGamesortby=dateview=markup

Search for the function called   int aalineColorInt(

It's *very* well commented.




cheers,


On Mon, Mar 30, 2009 at 2:12 AM, pymike pymik...@gmail.com wrote:

 I think if you look at a real SVG aaline...

 http://upload.wikimedia.org/wikipedia/commons/thumb/8/8f/Simple_polygon.svg/588px-Simple_polygon.svg.png

 ...then look at the pygame one...

 http://rene.f0o.com/~rene/stuff/aapolygon.png

 ...the latter looks pretty rough.

 --
 - pymike


Re: [pygame] multi-width aalines and aacircles

2009-03-29 Thread pymike
Yeah the svg one is a bit fuzzy, but the pygame one is just really messy
looking. The function you pointed to - isn't that for normal 1px width
aalines? Is it not possible to extend it to aapolygons?

-- 
- pymike


Re: [pygame] multi-width aalines and aacircles

2009-03-28 Thread René Dudfield
Hi,

very cool module :)

I uploaded some png's for people to see:
http://rene.f0o.com/~rene/stuff/aapolygon.png
http://rene.f0o.com/~rene/stuff/aacircle.png



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.


cheers,






On Thu, Mar 26, 2009 at 6:33 AM, Lenard Lindstrom le...@telus.net wrote:

 You can see for yourself:

 http://www3.telus.net/len_l/pygame/gfx_antialiasing.tar.gz

 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


 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.

 Lenard

 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 le...@telus.netmailto:
 le...@telus.net wrote:

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

Lenard


René Dudfield wrote:

good idea.

there's an aa-polygon in sdl gfx


On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing
greg.ew...@canterbury.ac.nz
mailto:greg.ew...@canterbury.ac.nz wrote:
Lenard Lindstrom wrote:

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







 --
 Lenard Lindstrom
 le...@telus.net




Re: [pygame] multi-width aalines and aacircles

2009-03-28 Thread René Dudfield
hi again,

Or for the draw stuff...
We could just include these two files:
src/SDL_gfx/SDL_gfxPrimitives.c
src/SDL_gfx/SDL_gfxPrimitives.h

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.


cheers,


On Sun, Mar 29, 2009 at 2:11 PM, René Dudfield ren...@gmail.com wrote:

 Hi,

 very cool module :)

 I uploaded some png's for people to see:
 http://rene.f0o.com/~rene/stuff/aapolygon.pnghttp://rene.f0o.com/%7Erene/stuff/aapolygon.png
 http://rene.f0o.com/~rene/stuff/aacircle.pnghttp://rene.f0o.com/%7Erene/stuff/aacircle.png



 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.


 cheers,







 On Thu, Mar 26, 2009 at 6:33 AM, Lenard Lindstrom le...@telus.net wrote:

 You can see for yourself:

 http://www3.telus.net/len_l/pygame/gfx_antialiasing.tar.gz

 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


 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.

 Lenard

 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 le...@telus.netmailto:
 le...@telus.net wrote:

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

Lenard


René Dudfield wrote:

good idea.

there's an aa-polygon in sdl gfx


On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing
greg.ew...@canterbury.ac.nz
mailto:greg.ew...@canterbury.ac.nz wrote:
Lenard Lindstrom wrote:

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







 --
 Lenard Lindstrom
 le...@telus.net





Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Greg Ewing

Lenard Lindstrom wrote:


Yes, but we still need an aaline algorithm with line width.


Find an aa polygon algorithm and then use it to
draw line-shaped polygons.

--
Greg



Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread René Dudfield
good idea.

there's an aa-polygon in sdl gfx


On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing greg.ew...@canterbury.ac.nz wrote:
 Lenard Lindstrom wrote:

 Yes, but we still need an aaline algorithm with line width.

 Find an aa polygon algorithm and then use it to
 draw line-shaped polygons.

 --
 Greg




Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Lenard Lindstrom

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

Lenard

René Dudfield wrote:

good idea.

there's an aa-polygon in sdl gfx


On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing greg.ew...@canterbury.ac.nz wrote:
  

Lenard Lindstrom wrote:



Yes, but we still need an aaline algorithm with line width.
  

Find an aa polygon algorithm and then use it to
draw line-shaped polygons.





--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread RB[0]
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 le...@telus.net wrote:

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

 Lenard


 René Dudfield wrote:

 good idea.

 there's an aa-polygon in sdl gfx


 On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing greg.ew...@canterbury.ac.nz
 wrote:


 Lenard Lindstrom wrote:



 Yes, but we still need an aaline algorithm with line width.


 Find an aa polygon algorithm and then use it to
 draw line-shaped polygons.





 --
 Lenard Lindstrom
 le...@telus.net




Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Ian Mallett
On Wed, Mar 25, 2009 at 11:47 AM, RB[0] roeb...@gmail.com wrote:

 You could do a filled polygon and then an aa one around it...

My suggestion exactly.  Too bad this doesn't work with circles...

 But I think then you'd be getting a lot slower...


Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Lenard Lindstrom
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.


Lenard

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 le...@telus.net 
mailto:le...@telus.net wrote:


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

Lenard


René Dudfield wrote:

good idea.

there's an aa-polygon in sdl gfx


On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing
greg.ew...@canterbury.ac.nz
mailto:greg.ew...@canterbury.ac.nz wrote:
 


Lenard Lindstrom wrote:

   


Yes, but we still need an aaline algorithm with line
width.
 


Find an aa polygon algorithm and then use it to
draw line-shaped polygons.

   






--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread pymike
I've drawn aalines over polygons before, and it doesn't always look right.

http://pymike.pynguins.com/downloads/Screenshot-GeoStrike.png

Look closely at the edges :)

On Wed, Mar 25, 2009 at 2:09 PM, Lenard Lindstrom le...@telus.net 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.

 Lenard

 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 le...@telus.netmailto:
 le...@telus.net wrote:

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

Lenard


René Dudfield wrote:

good idea.

there's an aa-polygon in sdl gfx


On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing
greg.ew...@canterbury.ac.nz
mailto:greg.ew...@canterbury.ac.nz wrote:

Lenard Lindstrom wrote:


Yes, but we still need an aaline algorithm with line
width.

Find an aa polygon algorithm and then use it to
draw line-shaped polygons.





 --
 Lenard Lindstrom
 le...@telus.net




-- 
- pymike


Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Lenard Lindstrom
That was what I saw when I first drew the filled polygon first. 
Reversing the operation cleaned it up some, removing the holes. The 
circle still has holes, but not so noticeable. But then this is just 
from two quick test programs with large shapes.


Lenard

pymike wrote:

I've drawn aalines over polygons before, and it doesn't always look right.

http://pymike.pynguins.com/downloads/Screenshot-GeoStrike.png

Look closely at the edges :)

On Wed, Mar 25, 2009 at 2:09 PM, Lenard Lindstrom le...@telus.net 
mailto:le...@telus.net 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.

Lenard

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
le...@telus.net mailto:le...@telus.net
mailto:le...@telus.net mailto:le...@telus.net wrote:

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

   Lenard


   René Dudfield wrote:

   good idea.

   there's an aa-polygon in sdl gfx


   On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing
   greg.ew...@canterbury.ac.nz
mailto:greg.ew...@canterbury.ac.nz
   mailto:greg.ew...@canterbury.ac.nz
mailto:greg.ew...@canterbury.ac.nz wrote:
   
   Lenard Lindstrom wrote:


 
   Yes, but we still need an aaline algorithm with

line
   width.
   
   Find an aa polygon algorithm and then use it to

   draw line-shaped polygons.

 




-



--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Ian Mallett
You might want to try drawing in orthagonally, and then rotating it as a
single surface.


Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Lenard Lindstrom

Ian Mallett wrote:
On Wed, Mar 25, 2009 at 11:47 AM, RB[0] roeb...@gmail.com 
mailto:roeb...@gmail.com wrote:


You could do a filled polygon and then an aa one around it...

My suggestion exactly.  Too bad this doesn't work with circles...

But I think then you'd be getting a lot slower... 

Well, here's the anti-aliased circle algorithm, with width, I found on 
the internet. aacircle.py is the program, aadraw.py the draw routines. 
It is much faster in its native Delphi.


Lenard

--
Lenard Lindstrom
le...@telus.net



aacircle.py
Description: application/python


aadraw.py
Description: application/python


Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread pymike
Meh, doesn't look like aa to me, just a nice blur. Takes a while to load too
:S Pre-rendered aa stuff is more or less useless.

On Wed, Mar 25, 2009 at 4:02 PM, Lenard Lindstrom le...@telus.net wrote:

 Ian Mallett wrote:

 On Wed, Mar 25, 2009 at 11:47 AM, RB[0] roeb...@gmail.com mailto:
 roeb...@gmail.com wrote:

You could do a filled polygon and then an aa one around it...

 My suggestion exactly.  Too bad this doesn't work with circles...

But I think then you'd be getting a lot slower...

 Well, here's the anti-aliased circle algorithm, with width, I found on the
 internet. aacircle.py is the program, aadraw.py the draw routines. It is
 much faster in its native Delphi.

 Lenard

 --
 Lenard Lindstrom
 le...@telus.net




-- 
- pymike


Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Lenard Lindstrom

Try the default Feather to 1.0, the default. But you are probably right.

Lenard

pymike wrote:
Meh, doesn't look like aa to me, just a nice blur. Takes a while to 
load too :S Pre-rendered aa stuff is more or less useless.


On Wed, Mar 25, 2009 at 4:02 PM, Lenard Lindstrom le...@telus.net 
mailto:le...@telus.net wrote:


Ian Mallett wrote:

On Wed, Mar 25, 2009 at 11:47 AM, RB[0] roeb...@gmail.com
mailto:roeb...@gmail.com mailto:roeb...@gmail.com
mailto:roeb...@gmail.com wrote:

   You could do a filled polygon and then an aa one around it...

My suggestion exactly.  Too bad this doesn't work with circles...

   But I think then you'd be getting a lot slower...

Well, here's the anti-aliased circle algorithm, with width, I
found on the internet. aacircle.py is the program, aadraw.py the
draw routines. It is much faster in its native Delphi.



--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Lenard Lindstrom
We could shamelessly rip off their code.  :-). Actually AGG is intended 
for high-quality rendering. Though the developers claim it is still 
fast, it may still not be fast enough for game usage.


Lenard

René Dudfield wrote:

c++

On Wed, Mar 25, 2009 at 10:27 PM, niki n...@vintech.bg wrote:
  

René Dudfield wrote:


good idea.

there's an aa-polygon in sdl gfx
  

Why not just use AGG? http://www.antigrain.com v2.4 is BSD (v2.5 is GPL but
dead)
It has AA for beziers too.






--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread Lenard Lindstrom

You can see for yourself:

http://www3.telus.net/len_l/pygame/gfx_antialiasing.tar.gz

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

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.


Lenard

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 le...@telus.net 
mailto:le...@telus.net wrote:


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

Lenard


René Dudfield wrote:

good idea.

there's an aa-polygon in sdl gfx


On Wed, Mar 25, 2009 at 5:38 PM, Greg Ewing
greg.ew...@canterbury.ac.nz
mailto:greg.ew...@canterbury.ac.nz wrote:

Lenard Lindstrom wrote:


  
Yes, but we still need an aaline algorithm with line

width.

Find an aa polygon algorithm and then use it to

draw line-shaped polygons.

  







--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-25 Thread pymike
Hmm. Still doesn't looks pretty rough. For aapolygons, can't you just take
SDL_gfx's method for antialiasing lines and apply it to the edges of the
polygon, and do the same thing for normal lines with widths? Or will the
algorithm only work with 1px wide lines?

I'll do some googling on aa algorithms.

-- 
- pymike


RE: [pygame] multi-width aalines and aacircles

2009-03-24 Thread John Krukoff
 -Original Message-
 From: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org] On
 Behalf Of Lenard Lindstrom
 Sent: Monday, March 23, 2009 6:07 PM
 To: pygame-users@seul.org
 Subject: Re: [pygame] multi-width aalines and aacircles
 
 None of the SDL_gfx functions has a line width argument that I could see.
 
 Lenard
 
 
 --
 Lenard Lindstrom
 le...@telus.net

Sure, but at least SDL_gfx gives you the tools you need to get there for AA
lines. A filled polygon, redraw the edges with an AA line, use some AA
circles to draw caps, and viola!

AA donuts would still be a pain, and require an offscreen buffer, which is
unfortunate.

And, likely you'd ask for variable width AA bezier curves next, which also
isn't supported. That one may be because it's hard, though.

--
John Krukoff
he...@comcast.net



Re: [pygame] multi-width aalines and aacircles

2009-03-24 Thread Marius Gedminas
On Tue, Mar 24, 2009 at 08:56:16AM -0600, John Krukoff wrote:
  -Original Message-
  From: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org] On
  Behalf Of Lenard Lindstrom
  Sent: Monday, March 23, 2009 6:07 PM
  To: pygame-users@seul.org
  Subject: Re: [pygame] multi-width aalines and aacircles
  
  None of the SDL_gfx functions has a line width argument that I could see.
 
 Sure, but at least SDL_gfx gives you the tools you need to get there for AA
 lines. A filled polygon, redraw the edges with an AA line, use some AA
 circles to draw caps, and viola!
 
 AA donuts would still be a pain, and require an offscreen buffer, which is
 unfortunate.
 
 And, likely you'd ask for variable width AA bezier curves next, which also
 isn't supported. That one may be because it's hard, though.

How about full Cairo support while we're at it?

;-)

Marius Gedminas
-- 
Programs that write programs are the happiest programs in the world.
-- Andrew Hume


signature.asc
Description: Digital signature


Re: [pygame] multi-width aalines and aacircles

2009-03-24 Thread RB[0]
I guess for now people could use this:
http://www.pygame.org/wiki/CairoPygame?parent=CookBook

But would be slow LOL, and would probably want a wrapper to handle all the
functions and converting and such...

On Tue, Mar 24, 2009 at 10:53 AM, Marius Gedminas mar...@gedmin.as wrote:

 On Tue, Mar 24, 2009 at 08:56:16AM -0600, John Krukoff wrote:
   -Original Message-
   From: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org]
 On
   Behalf Of Lenard Lindstrom
   Sent: Monday, March 23, 2009 6:07 PM
   To: pygame-users@seul.org
   Subject: Re: [pygame] multi-width aalines and aacircles
  
   None of the SDL_gfx functions has a line width argument that I could
 see.
 
  Sure, but at least SDL_gfx gives you the tools you need to get there for
 AA
  lines. A filled polygon, redraw the edges with an AA line, use some AA
  circles to draw caps, and viola!
 
  AA donuts would still be a pain, and require an offscreen buffer, which
 is
  unfortunate.
 
  And, likely you'd ask for variable width AA bezier curves next, which
 also
  isn't supported. That one may be because it's hard, though.

 How about full Cairo support while we're at it?

 ;-)

 Marius Gedminas
 --
 Programs that write programs are the happiest programs in the world.
-- Andrew Hume

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)

 iD8DBQFJyQIRkVdEXeem148RAmtEAJ9H72s8I/IeICsgmY4jtDJdVUFnuwCgkvuP
 czNhblnhWY/SZTJ/LC1N1Fs=
 =aG4D
 -END PGP SIGNATURE-




Re: [pygame] multi-width aalines and aacircles

2009-03-24 Thread Lenard Lindstrom

Marius Gedminas wrote:

On Tue, Mar 24, 2009 at 08:56:16AM -0600, John Krukoff wrote:
  

-Original Message-
From: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org] On
Behalf Of Lenard Lindstrom
Sent: Monday, March 23, 2009 6:07 PM
To: pygame-users@seul.org
Subject: Re: [pygame] multi-width aalines and aacircles

None of the SDL_gfx functions has a line width argument that I could see.
  

Sure, but at least SDL_gfx gives you the tools you need to get there for AA
lines. A filled polygon, redraw the edges with an AA line, use some AA
circles to draw caps, and viola!

AA donuts would still be a pain, and require an offscreen buffer, which is
unfortunate.

And, likely you'd ask for variable width AA bezier curves next, which also
isn't supported. That one may be because it's hard, though.



How about full Cairo support while we're at it?

;-)

Marius Gedminas
  
We could use Pango for text, wrap the whole thing with a gui layer and 
call it, oh I don't know, Gtk.


--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-24 Thread pymike
AA Bezier curves would be easy if they were just added in PADLib, which uses
lines() and aalines() to render bezier curves.

http://www.pygame.org/project/660/

And donuts look awful in pygame right now anyway :-P So really all that
needs to be added is aaline width and aapolygons

-- 
- pymike


Re: [pygame] multi-width aalines and aacircles

2009-03-24 Thread Lenard Lindstrom

pymike wrote:
AA Bezier curves would be easy if they were just added in PADLib, 
which uses lines() and aalines() to render bezier curves.


http://www.pygame.org/project/660/

And donuts look awful in pygame right now anyway :-P So really all 
that needs to be added is aaline width and aapolygons


--
- pymike
I am currently backporting Pygame Reloaded's SDL_gfx module into Pygame 
1.9. It will be optional (tentative) at first. As for anti-aliased thick 
circles, maybe use Os. :-)


--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-24 Thread Ian Mallett
On Tue, Mar 24, 2009 at 11:25 AM, pymike pymik...@gmail.com wrote:

 AA Bezier curves would be easy if they were just added in PADLib, which
 uses lines() and aalines() to render bezier curves.

That project is pretty old now, but if people need it, I could update it
some.
It *does *have AA support, though they are, of course, only 1 pixel thick.

Ian


Re: [pygame] multi-width aalines and aacircles

2009-03-24 Thread Lenard Lindstrom

pymike wrote:
 I am currently backporting Pygame Reloaded's SDL_gfx module into 
Pygame 1.9
Awesome, but it looks like pygame already has most of what's in the 
sdl_gfx library (rotozoom, aaline, etc.) :S And if SDL_gfx doesn't 
have line widths, how did pygame achieve it? Would it be possible to 
duplicate it for aalines?


 As for anti-aliased thick circles, maybe use Os. :-)
rofl

--
- pymike
Only the draw functions are exposed. It's possible they are faster than 
their pygame.draw equivalents since they use MMX. As for an aaline with 
width, having an algorithm to use would be a start. I do have an 
anti-aliased circle algorithm I translated to Python. Unfortunately I 
can't remember where I found it so am hesitant to use it.


Lenard

--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-24 Thread René Dudfield
hi,

The best way to help would be to write some unittests for it.  and
possibly extend, or write an example program.

How to compile pygame:
http://www.pygame.org/wiki/Compilation

tests/
examples/

That will make it way easier for someone to code it - and only
requires some python coding.

Or for extra points even have a go at C!   it's not that hard really.
Especially on ubuntu/linux.


cheers,




On Tue, Mar 24, 2009 at 3:32 AM, pymike pymik...@gmail.com wrote:

 PyGame desperately needs multi-width aalines and aacircles. Are there any 
 plans to implement these during GSoC or the next PyGame release?

 It'd really open up possibilities for pretty apps, vector art, and even SVG 
 libraries.

 --
 - pymike
 Python eggs me on.


Re: [pygame] multi-width aalines and aacircles

2009-03-24 Thread Lenard Lindstrom

Ian Mallett wrote:

You could always just draw aalines in a circle...

Yes, but we still need an aaline algorithm with line width.

--
Lenard Lindstrom
le...@telus.net



Re: [pygame] multi-width aalines and aacircles

2009-03-23 Thread RB[0]
Erm, sorry, meant having a width for aalines, I know aalines are already
there LOL

On Mon, Mar 23, 2009 at 11:36 AM, RB[0] roeb...@gmail.com wrote:

 I agree - I have wanted the aalines for a while now (for my lib)...
 Just wondering why this hasn't already been done, I saw some discussion on
 it a while back (like last year or further) about it being supported in SDL
 already and pygame just didn't make use of the API or something...
 Is that even correct?
 Circles sound interesting as well...


 On Mon, Mar 23, 2009 at 11:32 AM, pymike pymik...@gmail.com wrote:

 PyGame desperately needs multi-width aalines and aacircles. Are there any
 plans to implement these during GSoC or the next PyGame release?

 It'd really open up possibilities for pretty apps, vector art, and even
 SVG libraries.

 --
 - pymike
 Python eggs me on.





Re: [pygame] multi-width aalines and aacircles

2009-03-23 Thread RB[0]
I agree - I have wanted the aalines for a while now (for my lib)...
Just wondering why this hasn't already been done, I saw some discussion on
it a while back (like last year or further) about it being supported in SDL
already and pygame just didn't make use of the API or something...
Is that even correct?
Circles sound interesting as well...

On Mon, Mar 23, 2009 at 11:32 AM, pymike pymik...@gmail.com wrote:

 PyGame desperately needs multi-width aalines and aacircles. Are there any
 plans to implement these during GSoC or the next PyGame release?

 It'd really open up possibilities for pretty apps, vector art, and even SVG
 libraries.

 --
 - pymike
 Python eggs me on.



Re: [pygame] multi-width aalines and aacircles

2009-03-23 Thread Thiago Chaves
I'd be very happy to see those too, specially because I've been doing
lots of drawing with primitives on SSoF. =D

-Thiago

On Mon, Mar 23, 2009 at 6:32 PM, pymike pymik...@gmail.com wrote:
 PyGame desperately needs multi-width aalines and aacircles. Are there any
 plans to implement these during GSoC or the next PyGame release?

 It'd really open up possibilities for pretty apps, vector art, and even SVG
 libraries.

 --
 - pymike
 Python eggs me on.



Re: [pygame] multi-width aalines and aacircles

2009-03-23 Thread Forrest Voight
One idea was to bind SDL_gfx ... there's a patch for a binding a few
months back on this list.

On Mon, Mar 23, 2009 at 12:41 PM, Thiago Chaves shundr...@gmail.com wrote:
 I'd be very happy to see those too, specially because I've been doing
 lots of drawing with primitives on SSoF. =D

 -Thiago

 On Mon, Mar 23, 2009 at 6:32 PM, pymike pymik...@gmail.com wrote:
 PyGame desperately needs multi-width aalines and aacircles. Are there any
 plans to implement these during GSoC or the next PyGame release?

 It'd really open up possibilities for pretty apps, vector art, and even SVG
 libraries.

 --
 - pymike
 Python eggs me on.




Re: [pygame] multi-width aalines and aacircles

2009-03-23 Thread Lenard Lindstrom

None of the SDL_gfx functions has a line width argument that I could see.

Lenard

Forrest Voight wrote:

One idea was to bind SDL_gfx ... there's a patch for a binding a few
months back on this list.

On Mon, Mar 23, 2009 at 12:41 PM, Thiago Chaves shundr...@gmail.com wrote:
  

I'd be very happy to see those too, specially because I've been doing
lots of drawing with primitives on SSoF. =D

-Thiago

On Mon, Mar 23, 2009 at 6:32 PM, pymike pymik...@gmail.com wrote:


PyGame desperately needs multi-width aalines and aacircles. Are there any
plans to implement these during GSoC or the next PyGame release?

It'd really open up possibilities for pretty apps, vector art, and even SVG
libraries.

--
- pymike
Python eggs me on.

  



--
Lenard Lindstrom
le...@telus.net