That looks identical to some code I sent to Paul Nevai back in July. From
memory it worked quite well, albeit not highly optimised.

Plotting arcs is still quite simple if you use the parametric elliptical arc
algorithm. If anyone is after source for this I have it somewhere.

Gavin.

-----Original Message-----
From: Michael Glickman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 15 January 2002 9:16 AM
To: Palm Developer Forum
Subject: Drawing circle: example


Hi to all

I found a message sent to this mailing list just 1.5 months ago and I quote
it here.

It implements Bresenham algorithm (though this term isn't mentioned in the
original message).

This is not my code and I reproduce it verbatim. I had no time to test, but
as the code suggests it draws a circle of radius r with the centre in (x,
y). 

Drawing arcs is a bit trickier because of no symmetry.

Michael



-----Original Message-----
From: manish jaggi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 21 November 2001 8:07 PM
To: Palm Developer Forum
Cc: [EMAIL PROTECTED]
Subject: Circle Drawing source

/* The following is my only add-on. M.G. */ 
static void plotcircle ( int x, int y, int x1, int y1 );

void Circle(int x, int y, int r)
{
        int i, j, x1, y1, r, p, a ;
        x1 = 0 ;
        y1 = r ;

        p = 3 - 2 * r ;
        
        while ( x1 < y1 )
        {
                plotcircle ( x, y, x1, y1 ) ;
                
                if ( p < 0 )
                        p = p + 4 * x1 + 6 ;
                else
                {
                        p = p + 4 * ( x1 - y1 ) + 10 ;
                        y1 = y1 - 1 ;
                }

                x1 = x1 + 1 ;
        }

        if ( x1 == y1 )
                plotcircle ( x, y, x1, y1 ) ;
}


static void plotcircle ( int x, int y, int x1, int y1 )
{
        WinDrawPixel ( x + x1, y + y1 ) ;
        WinDrawPixel ( x - x1, y + y1  ) ;
        WinDrawPixel ( x + x1, y - y1  ) ;
        WinDrawPixel ( x - x1, y - y1  ) ;
        WinDrawPixel ( x + y1, y + x1  ) ;
        WinDrawPixel ( x - y1, y + x1  ) ;
        WinDrawPixel ( x + y1, y - x1  ) ;
        WinDrawPixel ( x - y1, y - x1  ) ;
}

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to