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

Re: [pygame] Antialiased circle



On 18/01/12 07:00 AM, Christopher Night wrote:
On Wed, Jan 18, 2012 at 4:49 AM, Florian Krause <siebenhundertzehn@xxxxxxxxx <mailto:siebenhundertzehn@xxxxxxxxx>> wrote:

    Maybe someone could translate from Java?
    http://www.databasesandlife.com/anti-aliased-polygon-filling-algorithm/


If that person's solution is acceptable for us, I don't think any translation is needed. It's pretty straightforward:

    /What about anti-aliasing? (My) solution: Run the algorithm at 4x
    X and Y resolution, and for each scanline of the algorithm, build
    up an internal array (one entry for each horizontal screen pixel),
    how many of the potential 16 subpixels should be plotted. After 4
    subpixel scanlines, plot the actual pixel scanline and clear the
    internal array./


So we could do it with a call to gfxdraw.filled_polygon then a call to transform.smoothscale. It seems sub-optimal, but maybe it's better than nothing.

Using 4x resolution at the boundaries for anti-aliasing calculations is worth considering.

Lenard Lindstrom