Hi Eduardo,
Here's my current circle routine. I haven't optimized the
circlePlotPoints function as yet.. I can't remember where I found the
basic routine, but if I do I'll give them credit when I create my
library...
#define VGAxy(x,y) ((y<<9)+(y<<7)+x)
void circleMidpoint(int xCenter, int yCenter, int radius, int color);
void circleMidpoint(int xCenter, int yCenter, int radius, int color) {
int x = 0;
int y = radius;
int p = 1 - radius;
void circlePlotPoints(int xCenter, int yCenter, int x, int y,int
color);
/* Plot first set of points */
circlePlotPoints(xCenter, yCenter, x, y, color);
while (x < y) {
x++;
if (p<0) p+=(x << 1)+1;
else { y--; p += ((x-y)<<1) + 1; }
circlePlotPoints(xCenter, yCenter, x, y, color);
}
}
void circlePlotPoints(int xCenter, int yCenter, int x, int y, int
color){
int Adr,x2,y2;
x2=(x<<1);
y2=(y<<1);
Adr=VGAxy((xCenter-x),(yCenter-y)); // Initial pair
fb[Adr]=color;
Adr+=x2;
fb[Adr]=color;
Adr=VGAxy((xCenter-x),(yCenter+y)); // 2nd pair
fb[Adr]=color;
Adr+=x2;
fb[Adr]=color;
Adr=VGAxy((xCenter-y),(yCenter-x)); // 3rd pair
fb[Adr]=color;
Adr+=y2;
fb[Adr]=color;
Adr=VGAxy((xCenter-y),(yCenter+x)); // 4th pair
fb[Adr]=color;
Adr+=y2;
fb[Adr]=color;
/*
I'm looking to calculate the center point address
(AdrBase = VGAxy(xCenter,yCenter)) and the (x*640)
and(y*640) and then add/subtract them along with
x/y to the base address as needed.
*/
}
Hope this works out for you.
Regards,
PJE
--- In "Eduardo Mendiola" <>
wrote:
>
> Do you know where I can get a copy of the circle drawing program?
>
> Thanks, Eduardo
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|