|
|
1.1 root 1: .ds ZZ DEVELOPMENT PACKAGE
2: .TH JSEGMENT 3L "630 MTG"
3: .XE "jline()"
4: .XE "jlineto()"
5: .XE "jsegment()"
6: .SH NAME
7: jsegment, jline, jlineto \- draw line on display
8: .SH SYNOPSIS
9: .B #include <dmd.h>
10: .sp
11: .B void jsegment (p, q, f)
12: .PP
13: .B void jline (p, f)
14: .PP
15: .B void jlineto (p, f)
16: .PP
17: .B Point p, q;
18: .br
19: .B Code f;
20: .SH DESCRIPTION
21: The
22: .I jline
23: function
24: draws a line in the display bitmap with Code
25: .I f
26: from the current window point (initially (0, 0) in window coordinates)
27: along the relative vector
28: .I p
29: which is in window coordinates.
30: .PP
31: The
32: .I jlineto
33: function
34: draws a line in the display bitmap from the current window point
35: to the absolute window coordinate
36: .IR p
37: with Code
38: .I f.
39: .PP
40: The
41: .I jsegment
42: function
43: draws a line in the diplay bitmap from the window coordinate
44: .I p
45: to the window coordinate
46: .IR q
47: with Code
48: .I f.
49: .PP
50: The
51: line functions
52: .IR jline ,
53: .IR jlineto ,
54: and
55: .I jsegment
56: leave the current window point at the end of the line.
57: .PP
58: .I PtCurrent
59: is the global used to refer to the current window point.
60: .SH EXAMPLE
61: The following program draws three boxes on the screen
62: using three different methods.
63: .PP
64: .RS 3
65: .ft CM
66: .nf
67: #include <dmd.h>
68:
69: main()
70: {
71: box(Rect(400,100,600,300));
72: rbox(Rect(0,0,200,200),Pt(0,300));
73: sbox(Rect(400,700,600,900));
74: request(KBD);
75: wait(KBD);
76: }
77:
78: /* draw absolute */
79: box(r)
80: Rectangle r;
81: {
82: jmoveto (r.origin);
83: jlineto (Pt (r.corner.x, r.origin.y), F_XOR);
84: jlineto (r.corner, F_XOR);
85: jlineto (Pt (r.origin.x, r.corner.y), F_XOR);
86: jlineto (r.origin, F_XOR);
87: }
88:
89: /* draw relative */
90: rbox(r, p)
91: Rectangle r;
92: Point p;
93: {
94: jmove (p);
95: jline (Pt (r.corner.x - r.origin.x, 0), F_XOR);
96: jline (Pt (0, r.corner.y - r.origin.y), F_XOR);
97: jline (Pt (r.origin.x - r.corner.x, 0), F_XOR);
98: jline (Pt (0, r.origin.y - r.corner.y), F_XOR);
99: }
100:
101: /* draw with segments */
102: sbox(r)
103: Rectangle r;
104: {
105: jsegment (r.origin, Pt(r.corner.x,
106: r.origin.y), F_XOR);
107: jsegment (Pt(r.corner.x, r.origin.y),
108: r.corner, F_XOR);
109: jsegment (r.corner, Pt(r.origin.x,
110: r.corner.y), F_XOR);
111: jsegment (Pt(r.origin.x, r.corner.y),
112: r.origin, F_XOR);
113: }
114: .fi
115: .ft R
116: .RE
117: .SH SEE ALSO
118: globals(3R), pt(3L), segment(3R), structures(3R), transform(3R/3L).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.