|
|
1.1 ! root 1: .ds ZZ DEVELOPMENT PACKAGE ! 2: .TH ELLIPSE 3L "630 MTG" ! 3: .XE "ellipse()" ! 4: .XE "eldisc()" ! 5: .XE "eldiscture()" ! 6: .XE "elarc()" ! 7: .SH NAME ! 8: ellipse, eldisc, eldiscture, elarc \- draw an ellipse ! 9: .SH SYNOPSIS ! 10: .B "#include <dmd.h>" ! 11: .sp ! 12: .B "void ellipse (bp, p, a, b, f)" ! 13: .PP ! 14: .B "void eldisc (bp, p, a, b, f)" ! 15: .PP ! 16: .B "void eldiscture (bp, p, a, b, t, f)" ! 17: .PP ! 18: .B "void elarc (bp, p, a, b, p1, p2, f)" ! 19: .PP ! 20: .B Bitmap \(**bp; ! 21: .br ! 22: .B Point p, p1, p2; ! 23: .br ! 24: .B int a, b; ! 25: .br ! 26: .B Texture16 \(**t; ! 27: .br ! 28: .B Code f; ! 29: .SH DESCRIPTION ! 30: The ! 31: .I ellipse ! 32: function ! 33: draws an ellipse centered at ! 34: .I p ! 35: with horizontal semi-axis ! 36: .I a ! 37: and vertical semi-axis ! 38: .I b ! 39: in Bitmap ! 40: .I bp ! 41: with Code ! 42: .IR f . ! 43: .PP ! 44: The ! 45: .I eldisc ! 46: function ! 47: draws an elliptical disc centered at ! 48: .I p ! 49: with horizontal semi-axis ! 50: .I a ! 51: and vertical semi-axis ! 52: .I b ! 53: in Bitmap ! 54: .I bp ! 55: with Code ! 56: .IR f . ! 57: .PP ! 58: The ! 59: .I eldiscture ! 60: function ! 61: draws an elliptical disc centered at ! 62: .I p ! 63: with horizontal semi-axis ! 64: .I a ! 65: and vertical semi-axis ! 66: .I b ! 67: in Bitmap ! 68: .I bp ! 69: using Texture16 ! 70: .I t ! 71: with Code ! 72: .IR f . ! 73: .PP ! 74: The ! 75: .I elarc ! 76: function ! 77: draws the corresponding elliptical arc, traveling ! 78: counterclockwise from the ellipse point closest to ! 79: .I p1 ! 80: to the point closest to ! 81: .IR p2 . ! 82: Note: Differences exist between the calling conventions for ! 83: .I arc ! 84: and ! 85: .IR elarc . ! 86: .SH EXAMPLE ! 87: The following routine can be used to allow a user to sweep out an ! 88: ellipse by holding button 1 down. ! 89: When button 1 is released, ! 90: the ellipse is filled using the elliptical disc routine. ! 91: .PP ! 92: .RS 3 ! 93: .nf ! 94: .ft CM ! 95: #include <dmd.h> ! 96: ! 97: main() ! 98: { ! 99: sweep_eldisc(); ! 100: request(KBD); ! 101: wait(KBD); ! 102: } ! 103: ! 104: sweep_eldisc() ! 105: { ! 106: Point p, c; ! 107: int a, b; ! 108: ! 109: request(MOUSE); ! 110: ! 111: while (!button1() ) ! 112: wait (MOUSE); ! 113: c = p = mouse.xy; ! 114: while (button1()) ! 115: if (!eqpt(p, mouse.xy)){ ! 116: if( !eqpt( p, c)) /* undraw old ellipse */ ! 117: ellipse (&display, c, a, b, F_XOR); ! 118: p = mouse.xy; ! 119: a = abs (p.x - c.x); ! 120: b = abs (p.y - c.y); ! 121: ellipse (&display, c, a, b, F_XOR); ! 122: } ! 123: ellipse (&display, c, a, b, F_XOR); ! 124: eldisc (&display, c, a, b, F_XOR); ! 125: } ! 126: .fi ! 127: .RE ! 128: .SH SEE ALSO ! 129: circle(3L), jcircle(3L), jellipse(3L).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.