OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / SGI / util / SGI / man / man3 / Tk_Draw3DPolygon.3
1 '\"
2 '\" Copyright (c) 1990-1993 The Regents of the University of California.
3 '\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4 '\"
5 '\" See the file "license.terms" for information on usage and redistribution
6 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 '\" 
8 '\" SCCS: @(#) 3DBorder.3 1.23 96/11/17 15:03:05
9 '\" 
10 '\" The definitions below are for supplemental macros used in Tcl/Tk
11 '\" manual entries.
12 '\"
13 '\" .AP type name in/out ?indent?
14 '\"     Start paragraph describing an argument to a library procedure.
15 '\"     type is type of argument (int, etc.), in/out is either "in", "out",
16 '\"     or "in/out" to describe whether procedure reads or modifies arg,
17 '\"     and indent is equivalent to second arg of .IP (shouldn't ever be
18 '\"     needed;  use .AS below instead)
19 '\"
20 '\" .AS ?type? ?name?
21 '\"     Give maximum sizes of arguments for setting tab stops.  Type and
22 '\"     name are examples of largest possible arguments that will be passed
23 '\"     to .AP later.  If args are omitted, default tab stops are used.
24 '\"
25 '\" .BS
26 '\"     Start box enclosure.  From here until next .BE, everything will be
27 '\"     enclosed in one large box.
28 '\"
29 '\" .BE
30 '\"     End of box enclosure.
31 '\"
32 '\" .CS
33 '\"     Begin code excerpt.
34 '\"
35 '\" .CE
36 '\"     End code excerpt.
37 '\"
38 '\" .VS ?version? ?br?
39 '\"     Begin vertical sidebar, for use in marking newly-changed parts
40 '\"     of man pages.  The first argument is ignored and used for recording
41 '\"     the version when the .VS was added, so that the sidebars can be
42 '\"     found and removed when they reach a certain age.  If another argument
43 '\"     is present, then a line break is forced before starting the sidebar.
44 '\"
45 '\" .VE
46 '\"     End of vertical sidebar.
47 '\"
48 '\" .DS
49 '\"     Begin an indented unfilled display.
50 '\"
51 '\" .DE
52 '\"     End of indented unfilled display.
53 '\"
54 '\" .SO
55 '\"     Start of list of standard options for a Tk widget.  The
56 '\"     options follow on successive lines, in four columns separated
57 '\"     by tabs.
58 '\"
59 '\" .SE
60 '\"     End of list of standard options for a Tk widget.
61 '\"
62 '\" .OP cmdName dbName dbClass
63 '\"     Start of description of a specific option.  cmdName gives the
64 '\"     option's name as specified in the class command, dbName gives
65 '\"     the option's name in the option database, and dbClass gives
66 '\"     the option's class in the option database.
67 '\"
68 '\" .UL arg1 arg2
69 '\"     Print arg1 underlined, then print arg2 normally.
70 '\"
71 '\" SCCS: @(#) man.macros 1.9 97/08/22 18:50:59
72 '\"
73 '\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
74 .if t .wh -1.3i ^B
75 .nr ^l \n(.l
76 .ad b
77 '\"     # Start an argument description
78 .de AP
79 .ie !"\\$4"" .TP \\$4
80 .el \{\
81 .   ie !"\\$2"" .TP \\n()Cu
82 .   el          .TP 15
83 .\}
84 .ie !"\\$3"" \{\
85 .ta \\n()Au \\n()Bu
86 \&\\$1  \\fI\\$2\\fP    (\\$3)
87 .\".b
88 .\}
89 .el \{\
90 .br
91 .ie !"\\$2"" \{\
92 \&\\$1  \\fI\\$2\\fP
93 .\}
94 .el \{\
95 \&\\fI\\$1\\fP
96 .\}
97 .\}
98 ..
99 '\"     # define tabbing values for .AP
100 .de AS
101 .nr )A 10n
102 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
103 .nr )B \\n()Au+15n
104 .\"
105 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
106 .nr )C \\n()Bu+\\w'(in/out)'u+2n
107 ..
108 .AS Tcl_Interp Tcl_CreateInterp in/out
109 '\"     # BS - start boxed text
110 '\"     # ^y = starting y location
111 '\"     # ^b = 1
112 .de BS
113 .br
114 .mk ^y
115 .nr ^b 1u
116 .if n .nf
117 .if n .ti 0
118 .if n \l'\\n(.lu\(ul'
119 .if n .fi
120 ..
121 '\"     # BE - end boxed text (draw box now)
122 .de BE
123 .nf
124 .ti 0
125 .mk ^t
126 .ie n \l'\\n(^lu\(ul'
127 .el \{\
128 .\"     Draw four-sided box normally, but don't draw top of
129 .\"     box if the box started on an earlier page.
130 .ie !\\n(^b-1 \{\
131 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
132 .\}
133 .el \}\
134 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
135 .\}
136 .\}
137 .fi
138 .br
139 .nr ^b 0
140 ..
141 '\"     # VS - start vertical sidebar
142 '\"     # ^Y = starting y location
143 '\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
144 .de VS
145 .if !"\\$2"" .br
146 .mk ^Y
147 .ie n 'mc \s12\(br\s0
148 .el .nr ^v 1u
149 ..
150 '\"     # VE - end of vertical sidebar
151 .de VE
152 .ie n 'mc
153 .el \{\
154 .ev 2
155 .nf
156 .ti 0
157 .mk ^t
158 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
159 .sp -1
160 .fi
161 .ev
162 .\}
163 .nr ^v 0
164 ..
165 '\"     # Special macro to handle page bottom:  finish off current
166 '\"     # box/sidebar if in box/sidebar mode, then invoked standard
167 '\"     # page bottom macro.
168 .de ^B
169 .ev 2
170 'ti 0
171 'nf
172 .mk ^t
173 .if \\n(^b \{\
174 .\"     Draw three-sided box if this is the box's first page,
175 .\"     draw two sides but no top otherwise.
176 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
177 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
178 .\}
179 .if \\n(^v \{\
180 .nr ^x \\n(^tu+1v-\\n(^Yu
181 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
182 .\}
183 .bp
184 'fi
185 .ev
186 .if \\n(^b \{\
187 .mk ^y
188 .nr ^b 2
189 .\}
190 .if \\n(^v \{\
191 .mk ^Y
192 .\}
193 ..
194 '\"     # DS - begin display
195 .de DS
196 .RS
197 .nf
198 .sp
199 ..
200 '\"     # DE - end display
201 .de DE
202 .fi
203 .RE
204 .sp
205 ..
206 '\"     # SO - start of list of standard options
207 .de SO
208 .SH "STANDARD OPTIONS"
209 .LP
210 .nf
211 .ta 4c 8c 12c
212 .ft B
213 ..
214 '\"     # SE - end of list of standard options
215 .de SE
216 .fi
217 .ft R
218 .LP
219 See the \\fBoptions\\fR manual entry for details on the standard options.
220 ..
221 '\"     # OP - start of full description for a single option
222 .de OP
223 .LP
224 .nf
225 .ta 4c
226 Command-Line Name:      \\fB\\$1\\fR
227 Database Name:  \\fB\\$2\\fR
228 Database Class: \\fB\\$3\\fR
229 .fi
230 .IP
231 ..
232 '\"     # CS - begin code excerpt
233 .de CS
234 .RS
235 .nf
236 .ta .25i .5i .75i 1i
237 ..
238 '\"     # CE - end code excerpt
239 .de CE
240 .fi
241 .RE
242 ..
243 .de UL
244 \\$1\l'|0\(ul'\\$2
245 ..
246 .TH Tk_Get3DBorder 3 4.0 Tk "Tk Library Procedures"
247 .BS
248 .SH NAME
249 Tk_Get3DBorder, Tk_Draw3DRectangle, Tk_Fill3DRectangle, Tk_Draw3DPolygon, Tk_Fill3DPolygon, Tk_3DVerticalBevel, Tk_3DHorizontalBevel, Tk_SetBackgroundFromBorder, Tk_NameOf3DBorder, Tk_3DBorderColor, Tk_3DBorderGC, Tk_Free3DBorder \- draw borders with three-dimensional appearance
250 .SH SYNOPSIS
251 .nf
252 \fB#include <tk.h>\fR
253 .sp
254 Tk_3DBorder
255 \fBTk_Get3DBorder(\fIinterp, tkwin, colorName\fB)\fR
256 .sp
257 void
258 \fBTk_Draw3DRectangle(\fItkwin, drawable, border, x, y, width, height, borderWidth, relief\fB)\fR
259 .sp
260 void
261 \fBTk_Fill3DRectangle(\fItkwin, drawable, border, x, y, width, height, borderWidth, relief\fB)\fR
262 .sp
263 void
264 \fBTk_Draw3DPolygon(\fItkwin, drawable, border, pointPtr, numPoints, polyBorderWidth, leftRelief\fB)\fR
265 .sp
266 void
267 \fBTk_Fill3DPolygon(\fItkwin, drawable, border, pointPtr, numPoints, polyBorderWidth, leftRelief\fB)\fR
268 .sp
269 void
270 \fBTk_3DVerticalBevel\fR(\fItkwin, drawable, border, x, y, width, height, leftBevel, relief\fB)\fR
271 .sp
272 void
273 \fBTk_3DHorizontalBevel\fR(\fItkwin, drawable, border, x, y, width, height, leftIn, rightIn, topBevel, relief\fB)\fR
274 .sp
275 void
276 \fBTk_SetBackgroundFromBorder(\fItkwin, border\fB)\fR
277 .sp
278 char *
279 \fBTk_NameOf3DBorder(\fIborder\fB)\fR
280 .sp
281 XColor *
282 \fBTk_3DBorderColor(\fIborder\fB)\fR
283 .sp
284 GC *
285 \fBTk_3DBorderGC(\fItkwin, border, which\fB)\fR
286 .sp
287 \fBTk_Free3DBorder(\fIborder\fB)\fR
288 .SH ARGUMENTS
289 .AS "Tk_3DBorder" borderWidth
290 .AP Tcl_Interp *interp in
291 Interpreter to use for error reporting.
292 .AP Tk_Window tkwin in
293 Token for window (for all procedures except \fBTk_Get3DBorder\fR,
294 must be the window for which the border was allocated).
295 .AP Tk_Uid colorName in
296 Textual description of color corresponding to background (flat areas).
297 Illuminated edges will be brighter than this and shadowed edges will
298 be darker than this.
299 .AP Drawable drawable in
300 X token for window or pixmap;  indicates where graphics are to be drawn.
301 Must either be the X window for \fItkwin\fR or a pixmap with the
302 same screen and depth as \fItkwin\fR.
303 .AP Tk_3DBorder border in
304 Token for border previously allocated in call to \fBTk_Get3DBorder\fR.
305 .AP int x in
306 X-coordinate of upper-left corner of rectangle describing border
307 or bevel, in pixels.
308 .AP int y in
309 Y-coordinate of upper-left corner of rectangle describing border or
310 bevel, in pixels.
311 .AP int width in
312 Width of rectangle describing border or bevel, in pixels.
313 .AP int height in
314 Height of rectangle describing border or bevel, in pixels.
315 .AP int borderWidth in
316 Width of border in pixels. Positive means border is inside rectangle
317 given by \fIx\fR, \fIy\fR, \fIwidth\fR, \fIheight\fR, negative means
318 border is outside rectangle.
319 .AP int relief in
320 Indicates 3-D position of interior of object relative to exterior;
321 should be TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, TK_RELIEF_GROOVE, 
322 TK_RELIEF_SOLID, or TK_RELIEF_RIDGE (may also be TK_RELIEF_FLAT
323 for \fBTk_Fill3DRectangle\fR).
324 .AP XPoint *pointPtr in
325 Pointer to array of points describing the set of vertices in a polygon.
326 The polygon need not be closed (it will be closed automatically if it
327 isn't).
328 .AP int numPoints in
329 Number of points at \fI*pointPtr\fR.
330 .AP int polyBorderWidth in
331 Width of border in pixels.  If positive, border is drawn to left of
332 trajectory given by \fIpointPtr\fR;  if negative, border is drawn to
333 right of trajectory.  If \fIleftRelief\fR is TK_RELIEF_GROOVE or
334 TK_RELIEF_RIDGE then the border is centered on the trajectory.
335 .AP int leftRelief in
336 Height of left side of polygon's path relative to right.  TK_RELIEF_RAISED
337 means left side should appear higher and TK_RELIEF_SUNKEN means right side
338 should appear higher;
339 TK_RELIEF_GROOVE and TK_RELIEF_RIDGE mean the obvious things.
340 For \fBTk_Fill3DPolygon\fR, TK_RELIEF_FLAT may also be specified to
341 indicate no difference in height.
342 .AP int leftBevel in
343 Non-zero means this bevel forms the left side of the object;  zero means
344 it forms the right side.
345 .AP int leftIn in
346 Non-zero means that the left edge of the horizontal bevel angles in,
347 so that the bottom of the edge is farther to the right than
348 the top.
349 Zero means the edge angles out, so that the bottom is farther to the
350 left than the top.
351 .AP int rightIn in
352 Non-zero means that the right edge of the horizontal bevel angles in,
353 so that the bottom of the edge is farther to the left than the top.
354 Zero means the edge angles out, so that the bottom is farther to the
355 right than the top.
356 .AP int topBevel in
357 Non-zero means this bevel forms the top side of the object;  zero means
358 it forms the bottom side.
359 .AP int which in
360 Specifies which of the border's graphics contexts is desired.
361 Must be TK_3D_FLAT_GC, TK_3D_LIGHT_GC, or TK_3D_DARK_GC.
362 .BE
363
364 .SH DESCRIPTION
365 .PP
366 These procedures provide facilities for drawing window borders in a
367 way that produces a three-dimensional appearance.  \fBTk_Get3DBorder\fR
368 allocates colors and Pixmaps needed to draw a border in the window
369 given by the \fItkwin\fR argument.  The \fIcolorName\fR
370 argument indicates what colors should be used in the border.
371 \fIColorName\fR may be any value acceptable to \fBTk_GetColor\fR.
372 The color indicated by \fIcolorName\fR will not actually be used in
373 the border;  it indicates the background color for the window
374 (i.e. a color for flat surfaces).
375 The illuminated portions of the border will appear brighter than indicated
376 by \fIcolorName\fR, and the shadowed portions of the border will appear
377 darker than \fIcolorName\fR.
378 .PP
379 \fBTk_Get3DBorder\fR returns a token that may be used in later calls
380 to \fBTk_Draw3DRectangle\fR.  If an error occurs in allocating information
381 for the border (e.g. \fIcolorName\fR isn't a legal color specifier),
382 then NULL is returned and an error message is left in \fIinterp->result\fR.
383 .PP
384 Once a border structure has been created, \fBTk_Draw3DRectangle\fR may be
385 invoked to draw the border.
386 The \fItkwin\fR argument specifies the
387 window for which the border was allocated, and \fIdrawable\fR
388 specifies a window or pixmap in which the border is to be drawn.
389 \fIDrawable\fR need not refer to the same window as \fItkwin\fR, but it
390 must refer to a compatible
391 pixmap or window:  one associated with the same screen and with the
392 same depth as \fItkwin\fR.
393 The \fIx\fR, \fIy\fR, \fIwidth\fR, and
394 \fIheight\fR arguments define the bounding box of the border region
395 within \fIdrawable\fR (usually \fIx\fR and \fIy\fR are zero and
396 \fIwidth\fR and \fIheight\fR are the dimensions of the window), and
397 \fIborderWidth\fR specifies the number of pixels actually
398 occupied by the border.  The \fIrelief\fR argument indicates
399 which of several three-dimensional effects is desired:
400 TK_RELIEF_RAISED means that the interior of the rectangle should appear raised
401 relative to the exterior of the rectangle, and
402 TK_RELIEF_SUNKEN means that the interior should appear depressed.
403 TK_RELIEF_GROOVE and TK_RELIEF_RIDGE mean that there should appear to be
404 a groove or ridge around the exterior of the rectangle.
405 .PP
406 \fBTk_Fill3DRectangle\fR is somewhat like \fBTk_Draw3DRectangle\fR except
407 that it first fills the rectangular area with the background color
408 (one corresponding
409 to the \fIcolorName\fR used to create \fIborder\fR).  Then it calls
410 \fBTk_Draw3DRectangle\fR to draw a border just inside the outer edge of
411 the rectangular area.  The argument \fIrelief\fR indicates the desired
412 effect (TK_RELIEF_FLAT means no border should be drawn; all that
413 happens is to fill the rectangle with the background color).
414 .PP
415 The procedure \fBTk_Draw3DPolygon\fR may be used to draw more complex
416 shapes with a three-dimensional appearance.  The \fIpointPtr\fR and
417 \fInumPoints\fR arguments define a trajectory, \fIpolyBorderWidth\fR
418 indicates how wide the border should be (and on which side of the
419 trajectory to draw it), and \fIleftRelief\fR indicates which side
420 of the trajectory should appear raised.  \fBTk_Draw3DPolygon\fR
421 draws a border around the given trajectory using the colors from
422 \fIborder\fR to produce a three-dimensional appearance.  If the trajectory is
423 non-self-intersecting, the appearance will be a raised or sunken
424 polygon shape.  The trajectory may be self-intersecting, although
425 it's not clear how useful this is.
426 .PP
427 \fBTk_Fill3DPolygon\fR is to \fBTk_Draw3DPolygon\fR what
428 \fBTk_Fill3DRectangle\fR is to \fBTk_Draw3DRectangle\fR:  it fills
429 the polygonal area with the background color from \fIborder\fR,
430 then calls \fBTk_Draw3DPolygon\fR to draw a border around the
431 area (unless \fIleftRelief\fR is TK_RELIEF_FLAT;  in this case no
432 border is drawn).
433 .PP
434 The procedures \fBTk_3DVerticalBevel\fR and \fBTk_3DHorizontalBevel\fR
435 provide lower-level drawing primitives that are used by
436 procedures such as \fBTk_Draw3DRectangle\fR.
437 These procedures are also useful in their own right for drawing
438 rectilinear border shapes.
439 \fBTk_3DVerticalBevel\fR draws a vertical beveled edge, such as the
440 left or right side of a rectangle, and \fBTk_3DHorizontalBevel\fR
441 draws a horizontal beveled edge, such as the top or bottom of a
442 rectangle.
443 Each procedure takes \fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR
444 arguments that describe the rectangular area of the beveled edge
445 (e.g., \fIwidth\fR is the border width for \fBTk_3DVerticalBevel\fR).
446 The \fIleftBorder\fR and \fItopBorder\fR arguments indicate the
447 position of the border relative to the ``inside'' of the object, and
448 \fIrelief\fR indicates the relief of the inside of the object relative
449 to the outside.
450 \fBTk_3DVerticalBevel\fR just draws a rectangular region.
451 \fBTk_3DHorizontalBevel\fR draws a trapezoidal region to generate
452 mitered corners;  it should be called after \fBTk_3DVerticalBevel\fR
453 (otherwise \fBTk_3DVerticalBevel\fR will overwrite the mitering in
454 the corner).
455 The \fIleftIn\fR and \fIrightIn\fR arguments to \fBTk_3DHorizontalBevel\fR
456 describe the mitering at the corners;  a value of 1 means that the bottom
457 edge of the trapezoid will be shorter than the top, 0 means it will
458 be longer.
459 For example, to draw a rectangular border the top bevel should be
460 drawn with 1 for both \fIleftIn\fR and \fIrightIn\fR, and the
461 bottom bevel should be drawn with 0 for both arguments.
462 .PP
463 The procedure \fBTk_SetBackgroundFromBorder\fR will modify the background
464 pixel and/or pixmap of \fItkwin\fR to produce a result compatible
465 with \fIborder\fR.  For color displays, the resulting background will
466 just be the color given by the \fIcolorName\fR argument passed to
467 \fBTk_Get3DBorder\fR when \fIborder\fR was created;  for monochrome
468 displays, the resulting background
469 will be a light stipple pattern, in order to distinguish the background from
470 the illuminated portion of the border.
471 .PP
472 Given a token for a border, the procedure \fBTk_NameOf3DBorder\fR
473 will return the \fIcolorName\fR string that was passed to
474 \fBTk_Get3DBorder\fR to create the border.
475 .PP
476 The procedure \fBTk_3DBorderColor\fR returns the XColor structure
477 that will be used for flat surfaces drawn for its \fIborder\fR
478 argument by procedures like \fBTk_Fill3DRectangle\fR.
479 The return value corresponds to the \fIcolorName\fR passed to
480 \fBTk_Get3DBorder\fR.
481 The XColor, and its associated pixel value, will remain allocated
482 as long as \fIborder\fR exists.
483 .PP
484 The procedure \fBTk_3DBorderGC\fR returns one of the X graphics contexts
485 that are used to draw the border.
486 The argument \fIwhich\fR selects which one of the three possible GC's:
487 TK_3D_FLAT_GC returns the context used for flat surfaces,
488 TK_3D_LIGHT_GC returns the context for light shadows,
489 and TK_3D_DARK_GC returns the context for dark shadows.
490 .PP
491 When a border is no longer needed, \fBTk_Free3DBorder\fR should
492 be called to release the resources associated with the border.
493 There should be exactly one call to \fBTk_Free3DBorder\fR for
494 each call to \fBTk_Get3DBorder\fR.
495
496 .SH KEYWORDS
497 3D, background, border, color, depressed, illumination, polygon, raised, shadow, three-dimensional effect