|
|
1.1 ! root 1: #ifndef MUX ! 2: #define Jcursinhibit() cursinhibit() ! 3: #define Jcursallow() cursallow() ! 4: #define lrectf(l, r, f) rectf(l, r, f) ! 5: #endif ! 6: ! 7: #include <jerq.h> ! 8: /* Fill a disc of radius r centered at x1,y1 ! 9: * The boundary is a sequence of vertically, horizontally, ! 10: * or diagonally adjacent points that minimize ! 11: * abs(x^2+y^2-r^2). ! 12: * ! 13: * The circle is guaranteed to be symmetric about ! 14: * the horizontal, vertical, and diagonal axes ! 15: */ ! 16: discture(b, p, r, t, f) ! 17: Bitmap *b; ! 18: Point p; ! 19: Texture *t; ! 20: { ! 21: short inhibited; ! 22: int eps,exy,dxsq,dysq; ! 23: register x0,y0,x1,y1; ! 24: r--; ! 25: eps = 0; ! 26: dxsq = 1; ! 27: dysq = 1 - 2*r; ! 28: x0 = p.x-1; ! 29: x1 = p.x+1; ! 30: y0 = p.y-r-1; ! 31: y1 = p.y+r; ! 32: inhibited=0; ! 33: if(f!=F_XOR){ ! 34: Jcursinhibit(); ! 35: inhibited=1; ! 36: } ! 37: while(y1 > y0) { ! 38: exy = eps + dxsq + dysq; ! 39: if(-exy <= eps+dxsq) { ! 40: ltexture(b, Rect(x0, y0, x1, y0+1), t, f); ! 41: ltexture(b, Rect(x0, y1, x1, y1+1), t, f); ! 42: y1--; ! 43: y0++; ! 44: eps += dysq; ! 45: dysq += 2; ! 46: } ! 47: if(exy <= -eps) { ! 48: x1++; ! 49: x0--; ! 50: eps += dxsq; ! 51: dxsq += 2; ! 52: } ! 53: } ! 54: if(inhibited) ! 55: Jcursallow(); ! 56: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.